Remove All Matching Values
L3 Easy Two Pointers
When you must remove values in place, use a write pointer for the "keep" position and a read pointer that scans the whole array.
Given an array nums and an integer val, remove every occurrence of val in place and return the number of remaining elements. The first count slots of nums should hold those remaining elements in their original relative order; ignore the rest.
Examples
▸ nums = [3, 2, 2, 3], val = 3
→ 2
▸ nums = [0, 1, 2, 2, 3, 0, 4, 2], val = 2
→ 5