HubSpot·Software Engineer·Technical Phone Screen
- Given an integer array and a target value, remove all occurrences of that value in place and return the count of remaining elements. The first k elements of the modified array should hold the valid values in any order. Must run in O(n) time with O(1) extra space.
“Two pointers is the move here and I kind of knew that going in, but I second-guessed myself for a bit on whether the order of remaining elements mattered.”