26 Remove Duplicates from Sorted Array
Last updated
Was this helpful?
Last updated
Was this helpful?
Given a sorted array, remove the duplicates 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 with O(1) extra memory.
Example:
时间复杂度O(n), 空间复杂度O(1)