26 Remove Duplicates from Sorted Array
1. Question
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this bymodifying the input array in-place with O(1) extra memory.
Example:
2. Implementation
3. Time & Space Complexity
时间复杂度O(n), 空间复杂度O(1)
Last updated