//water
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
for(vector<int>::iterator it=nums.begin();it!=nums.end();)
{
if(*it == val)nums.erase(it);
else it++;
}
return nums.size();
}
};

Leetcode027. Remove Element的更多相关文章

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

  2. [LeetCode] Remove Element 分析

    Remove Element算是LeetCode的一道水题,不过这题也有多种做法,现就我所知的几种做一点讨论. 题目链接:https://leetcode.com/problems/remove-el ...

  3. Remove Element,Remove Duplicates from Sorted Array,Remove Duplicates from Sorted Array II

    以下三个问题的典型的两个指针处理数组的问题,一个指针用于遍历,一个指针用于指向当前处理到位置 一:Remove Element Given an array and a value, remove a ...

  4. [Leetcode][Python]27: Remove Element

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 27: Remove Elementhttps://oj.leetcode.c ...

  5. 27. Remove Element【leetcode】

    27. Remove Element[leetcode] Given an array and a value, remove all instances of that value in place ...

  6. [array] leetCode-27. Remove Element - Easy

    27. Remove Element - Easy descrition Given an array and a value, remove all instances of that value ...

  7. leetcode-algorithms-27 Remove Element

    leetcode-algorithms-27 Remove Element Given an array nums and a value val, remove all instances of t ...

  8. 【LeetCode】27. Remove Element (2 solutions)

    Remove Element Given an array and a value, remove all instances of that value in place and return th ...

  9. [LeetCode] Remove Element题解

    Remove Element: Given an array and a value, remove all instances of that value in place and return t ...

随机推荐

  1. hadoop mapred-queue-acls 配置(转)

    hadoop作业提交时可以指定相应的队列,例如:-Dmapred.job.queue.name=queue2通过对mapred-queue-acls.xml和mapred-site.xml配置可以对不 ...

  2. OAF_VO系列1 - Accelerator Keys

    OAF_EO系列6 - Delete详解和实现(案例) (2014-06-16 08:37)

  3. NeHe OpenGL教程 第二十七课:影子

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

  4. ZOJ 3606 Lazy Salesgirl 浙江省第九届省赛

    Lazy Salesgirl Time Limit: 5 Seconds      Memory Limit: 65536 KB Kochiya Sanae is a lazy girl who ma ...

  5. YUV422/YUV420播放

    YUV播放器,directX,VS2008 MFC完成  CSDN下载 http://download.csdn.net/detail/xjt1988xjt/2386621#comment 默认是播放 ...

  6. android之SeekBar控件用法

    MainActivity.java package com.example.mars_2400_seekbar; import android.support.v7.app.ActionBarActi ...

  7. iOS获取电量方法

    ios简单的方法: [UIDevice currentDevice].batteryMonitoringEnabled = YES; double deviceLevel = [UIDevice cu ...

  8. Perl模块的安装方法

    1. 下载离线安装包 *.tar.gz的形式解包后,#perl Makefile.PL#make#make install 2. 在联网的情况下,通过CPAN安装# perl -MCPAN -e sh ...

  9. Nginx+Keepalived主主负载均衡服务器

    Nginx+keepalived主主负载均衡服务器测试实验环境: 主Nginx之一:192.168.11.27主Nginx之二:192.168.11.28Web服务器一:192.168.11.37We ...

  10. Java SE 第十六讲----面向对象特征之多态

    1.多态:polymorphism:我们说的子类就是父类(玫瑰是花,男子是人),因此多态的意思就是:父类型的引用可以指向子类的对象 public class PolyTest { public sta ...