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的更多相关文章

  1. [LeetCode] Remove Duplicates from Sorted Array II 有序数组中去除重复项之二

    Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For exampl ...

  2. [LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项

    Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...

  3. Remove Duplicates From Sorted Array

    Remove Duplicates from Sorted Array LeetCode OJ Given a sorted array, remove the duplicates in place ...

  4. 【leetcode】Remove Duplicates from Sorted Array II

    Remove Duplicates from Sorted Array II Follow up for "Remove Duplicates":What if duplicate ...

  5. 26. Remove Duplicates from Sorted Array

    题目: Given a sorted array, remove the duplicates in place such that each element appear only once and ...

  6. 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 ...

  7. LeetCode:Remove Duplicates from Sorted Array I II

    LeetCode:Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place su ...

  8. 【26】Remove Duplicates from Sorted Array

    [26]Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such th ...

  9. leetCode 26.Remove Duplicates from Sorted Array(删除数组反复点) 解题思路和方法

    Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that e ...

随机推荐

  1. Android Gradle实用技巧——多渠道打包

    友盟有很多不错的功能,例如渠道统计等. 想要做渠道统计,有一个要求就是要在manifest文件中添加各个渠道的配置.只有一两个渠道还好说,但是渠道多了的话,手动修改然后打包简直是噩梦. 幸好现在And ...

  2. IO - IOUtils

    Commons IO is a library of utilities to assist with developing IO functionality. There are four main ...

  3. hdu 5444 Elven Postman 二叉树

    Time Limit: 1500/1000 MS (Java/Others)   Memory Limit: 131072/131072 K (Java/Others) Problem Descrip ...

  4. 【JavaScript】微信适配的Head

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <me ...

  5. 转-Android微信支付

    http://blog.fangjie.info/android微信支付/ Android微信支付 2014-08-09 一.使用微信官方的提供的demo里的appid等 1.微信接口上手指南:(从“ ...

  6. 设置presentVC跟PushVC一样的效果即从右到左的动画

    SettingViewController *VC = [[SettingViewControlleralloc]init]; VC.view.backgroundColor = [UIColorwh ...

  7. samba共享修改匿名用户为非nobody

    samba共享修改匿名用户为非nobody 1)linux的samba用户,如果开启匿名用户登陆共享权限,security 设置为 share ,配置如下:[root@centos69:~]$grep ...

  8. Zabbix监控mysql配置及故障告警配置

    本文主要介绍zabbix监控mysql的配置,包含使用zabbix自带模板监控mysql相关信息及自定义key监控mysql同步情况.同时介绍了触发器的创建及zabbix通过邮件方式告警配置. 一.配 ...

  9. Linux 下绑定域名与IP地址

    在 Linux 下,hosts 文件的路径是 /etc/hosts,此文件需要有root权限才可编辑,条目也是通过“IP 域名”的格式将域名与IP进行绑定. 对 Linux 的 hosts 配置文件的 ...

  10. SPCOMM的一些用法注意

      使用串口SPCOMM接收数据的时候0x11和0x13无法接受,从时间间隔上看来可以接收,但是无法显示.网上查错误得: --------------------------------------- ...