In-Place Removal of Specific Array Values

The objective is to modify an integer array by removing all instances of a specific value directly within the original memory space. The function must return the new length of the array after removal. Constraints and Mechanics The solution must adhere to strict space complexity requirements: O(1) Extra Space: No additional arrays or data struc ...

Posted on Wed, 03 Jun 2026 17:23:48 +0000 by jordy

In-Place Filtering and Squaring of Sorted Arrays via Two-Pointer Techniques

Problem 1: In-Place Removal of Target Value Given an integer array nums and a integer val, remove every occurrence of val in place. The relative order of the remaining elements may change. Return the new length k such that the first k slots of nums contain all elements that are not equal to val. The rest of the array is ignored by the judge. Co ...

Posted on Sat, 09 May 2026 15:57:34 +0000 by jd57