Meta phone screens often start with this problem to assess your two-pointer fundamentals.
You have an integer array nums. Move all s to the end while keeping the relative order of non-zero elements. You must do this in-place without making a copy of the array.
For example, nums = [0,1,0,3,12] becomes [1,3,12,0,0].
Before reading the solution, think about this: if you scan left to right, how do you track where the next non-zero element should go?
Constraints: , values from to .