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 ...
随机推荐
- RMAN_Oracle RMAN的常用Configure配置
2014-12-09 Created By BaoXinjian
- Java语法基础动手动脑实践
输出结果为: 0.05+0.01=0.0600000000000000051.0-0.42=0.58000000000000014.015*100401.49999999999994123.3/100 ...
- 转--Android中自定义字体的实现方法
1.Android系统默认支持三种字体,分别为:“sans”, “serif”, “monospace 2.在Android中可以引入其他字体 . 复制代码 代码如下: <?xml versio ...
- JAVA 综合布局应用
//布局综合应用 import java.awt.*; import javax.swing.*; public class Jiemian4 extends JFrame{ JPanel mb1,m ...
- 使用BeanUtils操作Bean属性
package com.wzh.test.beanutils; import java.lang.reflect.InvocationTargetException; import java.text ...
- async callback z
public class StackOverflow_5979252 { [ServiceContract(Name = "IMessageCallback")] public i ...
- "undefined reference to" 问题解决方法 -链接问题
最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于unde ...
- [ActionScript 3.0] Away3D 天空盒(skybox)例子
/* SkyBox example in Away3d Demonstrates: How to use a CubeTexture to create a SkyBox object. How to ...
- relative和absolute的效果
我对这样几个效果不是特别理解: 1.float的效果: 就是搞不清楚我想要什么效果的时候可以将某个标签设置为float,一直没总结出什么规律. 2.relative和absolute的效果: 也是不清 ...
- CSS从大图中抠取小图完整教程(background-position应用)
CSS从大图中抠取小图完整教程(background-position应用) 转自: http://www.cnblogs.com/iyangyuan/archive/2013/06/01/3111 ...