Given an integer array nums sorted in non-decreasing order, remove the duplicates so each unique element appears only once. Return the array of unique values, maintaining their relative order.
nums
nums = [1,1,2]
[1,2]
nums = [0,0,1,1,1,2,2,3,3,4]
[0,1,2,3,4]
1 <= nums.length <= 3 * 10^4 nums is sorted in non-decreasing order.
Topics
Implement removeDuplicates in the editor and return the answer — printing it is never graded.
removeDuplicates
Problem 11 of 1146 in the arena