dsa · easy

Remove Duplicates from Sorted Array

Non-decreasing nums. Return the unique values **in order** (drop duplicates).

Arguments

**Example:** [1,1,2][1,2].

Example

`` Input: [1,1,2] Output: [1,2] ``

Constraints

0 <= nums.length <= 3 * 10^4 nums is sorted in non-decreasing order 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]

Open in the Dojo editor