描述
Given a sorted array, remove the duplicates in place such that each element appear onlyonce 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].分析无代码1 public class solution { 2 3 public static void main(String[] args) { 4 5 int[] A= {1,1,1,2,2,3}; 6 int n = A.length; 7 int index=removeDuplicates(A,n); 8 int[] B=new int[index];//定义好数组长度不好改 9 for(int i=0;i