1. water
  2. class Solution {
  3. public:
  4. int removeDuplicates(vector<int>& nums) {
  5. for(vector<int>::iterator it=nums.begin();it!=nums.end();)
  6. {
  7. int cur=*it;
  8. it++;
  9. while(it != nums.end() && *it == cur)nums.erase(it);
  10. }
  11. return nums.size();
  12. }
  13. };

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转投iOS原因大起底

    据报道,近期在欧洲,有32.4%的新ios设备iPhone用户之前使用的是Android设备.那么为什么欧洲会有这么多Android用户会纷纷抛弃原有操作系统平台而转投iPhone呢? ios设备的同 ...

  2. NeHe OpenGL教程 第十课:3D世界

    转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...

  3. ndk android studio万年坑

    先说javah万年坑 javah语法: Usage: javah [options] <classes> where [options] include: -o <file>  ...

  4. Cordova是做什么的

    Cordova提供了一组设备相关的API,通过这组API,移动应用能够以JavaScript访问原生的设备功能,如摄像头.麦克风等. Cordova还提供了一组统一的JavaScript类库,以及为这 ...

  5. mysql如何给汉字按照首字母顺序排序

    select * from 表名 order by convert(列明 USING gbk) COLLATE gbk_chinese_ci asc

  6. android 4.4 状态栏隐藏

    这个是Android Developer上的原文 反正我也看得不是很懂 我知道的就是实现和导航栏和状态栏的透明 带一些渐变效果 1. 设置主题 <style name="Theme.T ...

  7. [SQL]SQL语言入门级教材_SQL功能与特性(一)

    SQL功能与特性 其实,在前面的文章中,已经提及SQL命令的一些基本功能.然而,通过 SQL命令,程序设计师或数据库管理员(DBA)可以: (一)建立数据库的表格.(包括设置表格所可以使用之空间) ( ...

  8. FreeMarker页面中获得contextPath

    要在ftl页面中使用contextPath,需要在viewResolver中做如下配置(红色部分): <bean id="viewResolver" class=" ...

  9. sql server 2008 System.Data.SqlClient.SqlException (0x80131904): 查询处理器未能为执行并行查询启动必要的线程资源 处理方法

    修改并行度: 修改了这个“最大并行度”,如果再没出现 cxpacket应该没问题了 参考资料:http://jingyan.baidu.com/article/5d6edee22daf8799eade ...

  10. Codeforces 404D [DP]

    /* 我是一个习惯后悔,但是没办法忍受内疚感的二货== 这题是个无脑dp,但是比赛大概20min没出...其实最后5min我好好想想简单化边界条件,可以出的. 题意: 给你一个长度为1e6的由?*01 ...