← 返回 nvidia 的题目列表Remove Duplicates from Sorted Array
类型:online_judge
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and return the new length. Use O(1) extra space. Modify the array in-place to contain unique items and return the new length. Example Input: nums = [1, 1, 2], Output: 2 (new array is [1, 2] and you modify the array in-place). No library functions allowed.
Example
Input
nums = [1, 1, 2]