LeetCode 80. Remove Duplicates from Sorted Array II
来源:互联网 发布:卖家被淘宝封号前预兆 编辑:程序博客网 时间:2024/06/13 10:19
和LeetCode 26. Remove Duplicates from Sorted Array相似
在升序数组中,每个数字最多只能出现2次。
代码:
class Solution {public: int removeDuplicates(int A[], int n) { int length = 0; for (int i=0; i < n; ){A[length ++] = A[i ++];if (i<n && A[i-1]==A[i]){A[length ++] = A[i ++];}for ( ; i<n && A[i]==A[i-1]; ++ i) {}}return length; }};
0 0
- leetcode——26. Remove Duplicates from Sorted Array && 80. Remove Duplicates from Sorted Array II
- LeetCode 26. Remove Duplicates from Sorted Array && 80. Remove Duplicates from Sorted Array II
- leetcode.array--80. Remove Duplicates from Sorted Array II
- LeetCode: Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted Array II
- LeetCode: Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted Array II
- [LeetCode] Remove Duplicates from Sorted Array II
- [leetcode] Remove Duplicates from Sorted Array II
- [LeetCode]Remove Duplicates from Sorted Array II
- [leetcode]Remove Duplicates from Sorted Array II
- LeetCode-Remove Duplicates from Sorted Array II
- [leetcode] Remove Duplicates from Sorted Array II
- LeetCode - Remove Duplicates from Sorted Array II
- LeetCode:Remove Duplicates from Sorted Array II
- LeetCode | Remove Duplicates from Sorted Array II
- Leetcode: Remove Duplicates from Sorted Array II
- 【leetcode】Remove Duplicates from Sorted Array II
- 天气预报功能--查询广州天气的实现
- 2014年辛星jquery解读第二节
- 接口隔离原则
- 男孩卡在车窗上离奇身亡 停放不当车主要赔14万
- 2014年辛星jquery解读第三节 Ajax
- LeetCode 80. Remove Duplicates from Sorted Array II
- ELMAH and API controller in MVC4 not logging errors
- 映像记忆表3
- 面试题
- 2014年辛星php框架编写之starphp之前言
- 实现Web应用的整体安全
- LeetCode 81. Search in Rotated Sorted Array II
- LeetCode 82. Remove Duplicates from Sorted List
- 8.1 Subsets