LeetCode之Remove Duplicates from Sorted Array

来源:互联网 发布:inside游戏 知乎 编辑:程序博客网 时间:2024/05/20 02:21
int removeDuplicates(int A[], int n) //Remove Duplicates from Sorted Array {if (n == 0) return 0;int index = 0;for (int i = 1; i < n; i++) {if (A[index] != A[i])A[++index] = A[i];}return index + 1;}

0 0
原创粉丝点击