一步一个阶梯,向人类进化。
分类: Java
2014-12-29 15:54:09
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].
删除数组中重复的元素,要求空间复杂度为O(1),即只能在原数组操作,不能开辟新内存。点击(此处)折叠或打开