dsa · easy
Remove Duplicates from Sorted Array
GreyOrangeArrayTwo PointersFoundation
Sorted nums. Return the unique values **in order** (drop duplicates).
Arguments
nums— the input array of integers
**Example:** [1,1,2] → [1,2].
Constraints
0 <= nums.length <= 3 * 10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: [1,1,2] Expected: [1,2]
Example 2
Input: [0,0,1,1,1,2,2,3,3,4] Expected: [0,1,2,3,4]