Leetcode#26 Remove Duplicates from Sorted Array

原题地址

基本模拟题

代码:

 1 int removeDuplicates(int A[], int n) {
 2         if (n <= 0)
 3             return 0;
 4             
 5         int i = 1;
 6         int j = 0;
 7         
 8         while (i < n) {
 9             if (A[i] != A[j])
10                 A[++j] = A[i];
11             i++;
12         }
13         
14         return j + 1;
15 }
原文地址:https://www.cnblogs.com/boring09/p/4267176.html