Leetcode026. Remove Duplicates from Sorted Array
water
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
for(vector<int>::iterator it=nums.begin();it!=nums.end();)
{
int cur=*it;
it++;
while(it != nums.end() && *it == cur)nums.erase(it);
}
return nums.size();
}
};
Leetcode026. Remove Duplicates from Sorted Array的更多相关文章
- [LeetCode] Remove Duplicates from Sorted Array II 有序数组中去除重复项之二
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For exampl ...
- [LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项
Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...
- Remove Duplicates From Sorted Array
Remove Duplicates from Sorted Array LeetCode OJ Given a sorted array, remove the duplicates in place ...
- 【leetcode】Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array II Follow up for "Remove Duplicates":What if duplicate ...
- 26. Remove Duplicates from Sorted Array
题目: Given a sorted array, remove the duplicates in place such that each element appear only once and ...
- 50. Remove Duplicates from Sorted Array && Remove Duplicates from Sorted Array II && Remove Element
Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that e ...
- LeetCode:Remove Duplicates from Sorted Array I II
LeetCode:Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place su ...
- 【26】Remove Duplicates from Sorted Array
[26]Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such th ...
- leetCode 26.Remove Duplicates from Sorted Array(删除数组反复点) 解题思路和方法
Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that e ...
随机推荐
- memcached应用场景(转)
memcached最吸引人的地方主要在于它的分布式.分布式对于互联网应用来讲,按照用途基本上可划分为三种方式:分布式计算.分布式存储和两者兼而有之.memcached是分布式存储的一种.我们常见的分 ...
- Skip StyleCop Warnings.
[SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMust ...
- Javascript金额转化
//"123,456.78"----> 123456.78(float格式) function rmoney(s) { return parseFloat(s.replace ...
- 由csdn开源项目评选中闹出刷票问题想到投票程序的设计
帖子<#CSDN刷票门# 有没有人在恶意刷票?CSDN请告诉我!用24小时监控数据说话!> http://www.cnblogs.com/sanshi/p/3155946.html 网站投 ...
- VC++、MFC、COM和ATL的区别
今天看到的,感觉不错.转载了 一.什么是MFC 微软基础类(Microsoft Foundation Classes),实际上是微软提供的,用于在C++环境下编写应用程序的一个框架和引擎,VC++是W ...
- 转--Android中自定义字体的实现方法
1.Android系统默认支持三种字体,分别为:“sans”, “serif”, “monospace 2.在Android中可以引入其他字体 . 复制代码 代码如下: <?xml versio ...
- MySQL运算符之 <=>
问题 : 我在看以前的一个开发者的代码时看到 WHERE p.name <=> NULL 在这个查询语句中 <=>符号是什么意思啊?是不是和 =号是一样啊?还是一个语法错误啊? ...
- Git中的文件状态和使用
(暂存区 即Index In Git) commit 到 local respository的内容,不想push,则使用git reset 将文件状态回转到staged|modified|unstag ...
- Wex5案例使用JSON传输Thinkphp后端对接,以达成数据正常输出
初步接触Wex5,操作起来还是觉得比较复杂!而且教程不多,让我着实比较烦躁! 因此自己动手丰衣足食!还是比较实在的! 采用版本:WeX5应用快速开发框架V3.5正式版 我们使用Wex5的仿淘宝APP案 ...
- 【转】group by多个字段理解
来源:http://uule.iteye.com/blog/1569262 首先group by 的简单说明: group by 一般和聚合函数一起使用才有意义,比如 count sum avg等,使 ...