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 in place with constant memory.
For example,
Given input array A = [1,1,2],
Your function should return length = 2, and A is now [1,2].
{优快云:CODE:633762}

本文介绍了一个算法问题:如何在不使用额外空间的情况下从已排序数组中去除重复元素,并保持元素只出现一次,同时返回新的长度。例如,对于输入数组 [1,1,2],经过处理后应返回长度为2,且数组变为 [1,2]。
373

被折叠的 条评论
为什么被折叠?



