Given a sorted integer array nums, remove duplicates in-place such that each unique element appears only once. Return the count of unique elements k. The first k elements of nums must hold the unique values.
nums = [1,1,2]k=2, nums=[1,2,_]Since the array is sorted, duplicates are adjacent. The slow pointer holds the last accepted unique value. Fast advances through duplicates without writing. The moment fast finds a different value, slow advances one step and receives the new unique — overwriting the now-useless duplicate position.