[leetcode刷题系列]Remove Duplicates from Sorted Array II
来源:互联网 发布:西安软件测试培训 编辑:程序博客网 时间:2024/05/29 14:36
在1的基础上做个标记就好了- -
class Solution {public: int removeDuplicates(int A[], int n) { // Start typing your C/C++ solution below // DO NOT write int main() function if(n <= 0) return n; int valid = 0; int dup = 0; for(int i = 1; i < n; ++ i) if(A[i] != A[valid]){ dup = 0; A[++valid] = A[i]; }else{ if(dup <= 0){ A[++valid] = A[i]; ++ dup; } } return valid + 1; }};
- [leetcode刷题系列]Remove Duplicates from Sorted Array II
- leetcode刷题系列C++-Remove Duplicates From Sorted Array II
- 【Leetcode长征系列】Remove Duplicates from Sorted Array II
- [leetcode刷题系列]Remove Duplicates from Sorted Array
- leetcode刷题系列C++-Remove Duplicates From Sorted Array
- [leetcode刷题系列]Remove Duplicates from Sorted List 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
- 一元二次方程,运算符的优先级
- 转一篇关于undo tablespace切换的文章
- DB2命令
- 使用httpHttpURLConnection上传多张图片和文字的方法
- MYSQL:查看的数据库表空间
- [leetcode刷题系列]Remove Duplicates from Sorted Array II
- uva 442
- Strurts(四)——从Struts原型模拟看大道至简(含实例下载)
- ubuntu的配置文件
- java 通过模拟cookies登陆新浪微博
- Cocos2D-X 书籍(入门推荐)
- poj 2955 brackets
- 3D开源点库(PointCloud Library)介绍
- 移动平台前端开发总结(针对iphone,Android等手机)