Read / Write Heads
Two pointers walk the same array in the same direction: a read head scans every element, and a write head marks where the next kept element belongs. Whatever the read head decides to keep gets written at the write head, which only then advances - so the prefix [0, write) is always the compacted answer.
Remove Elements
27. Remove Element
283. Move Zeroes
1119. Remove Vowels from a String
Easy·
Solutions:
FIG. 1119 REMOVE VOWELS FROM A STRING● INTERACTIVE
Remove Elements from Sorted Array
80. Remove Duplicates from Sorted Array II
Medium·
Solutions:
FIG. 80 REMOVE DUPLICATES FROM SORTED ARRAY II● INTERACTIVE
26. Remove Duplicates from Sorted Array
Easy·
Solutions:
FIG. 26 REMOVE DUPLICATES FROM SORTED ARRAY● INTERACTIVE