public class Solution { public int removeDuplicates(int[] A) { if(A.length == 0) return 0; int count = 1; for(int i = 1; i < A.length; i++){ if(A[i-1] == A[i]) continue; A[count++] = A[i]; } return count; } }
public class Solution { public int removeDuplicates(int[] A) { if(A.length == 0) return 0; int count = 1; for(int i = 1; i < A.length; i++){ if(A[i-1] == A[i]) continue; A[count++] = A[i]; } return count; } }