题目本身是去重

由于我很懒,所以用了STL库里的unique函数来去重,小伙伴们可以考虑自己实现去重的函数,其实并不复杂。

 class Solution {
public:
int removeDuplicates(vector<int>& nums) {
return unique(nums.begin(),nums.end()) - nums.begin();
}
};

Leetcode 26 Remove Duplicates from Sorted Array STL的更多相关文章

  1. LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] <c++>

    LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] <c++> 给出排序好的 ...

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

    Given a sorted array nums, remove the duplicates in-place such that each element appear only once an ...

  3. [LeetCode] 26. Remove Duplicates from Sorted Array ☆(从有序数组中删除重复项)

    [LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项 描述 Given a sorted array nums, remove the d ...

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

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

  5. LeetCode 26. Remove Duplicates from Sorted Array (从有序序列里移除重复项)

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

  6. leetcode 26—Remove Duplicates from Sorted Array

    Given a sorted array nums, remove the duplicates in-place such that each element appear only once an ...

  7. LeetCode 26 Remove Duplicates from Sorted Array

    Problem: Given a sorted array, remove the duplicates in place such that each element appear only onc ...

  8. Java [leetcode 26]Remove Duplicates from Sorted Array

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

  9. Leetcode 26. Remove Duplicates from Sorted Array (easy)

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

随机推荐

  1. Scrum会议10.20

    Scrum会议   组名称:好好学习 项目名称:记账本 参会成员:林莉(Master)胡丽娜 汪东涵 宫丽君 时间:2016.10.20 已完成内容: 1.理解项目和代码. 2.讨论新功能. 计划完成 ...

  2. C#委托使用:多播 ,向委托注册多个方法

    private static void EnglishGreeting(string name) { Console.WriteLine("Morning, " + name); ...

  3. 如何MSHTML命名空间解析HTML文件(MSHTML::IHTMLDocument2Ptr 提示错误)

    1.创建Win32或MFC工程. 2.在预编译或需要使用MSHTML命名空间的头文件中添加以下语句: #include <atlbase.h>    #include <Mshtml ...

  4. AjaxControlToolkit MaskedEdit Unspecified error 未指定错误

    使用AjaxControlToolkit 里面的 MaskedEditValidator控件,IE里面在如下的js中出现未指定(Unspecified error)错误, if (document.a ...

  5. StringBuffer

    1.StringBuffer StringBuffer类和String一样,也用来代表字符串,只是由于StringBuffer的内部实现方式和String不同,所以StringBuffer在进行字符串 ...

  6. 转自知乎:GitHub基本功能

    作者:Fadeoc Khaos 链接:https://www.zhihu.com/question/20070065 来源:知乎 著作权归作者所有Github的基本功能: Repository:你和我 ...

  7. Pair Project: Elevator Scheduler [电梯调度算法的实现和测试]

    作业提交时间:10月9日上课前. Design and implement an Elevator Scheduler to aim for both correctness and performa ...

  8. mac 下真机调试 android 手机

    第一步: 查看usb设备信息 在 终端输入:system_profiler SPUSBDataType     可以查看连接的usb设备的信息 比如我的usb信息如下(部分内容): Spreadtru ...

  9. Git命令行初体验

    1. git 版本控制系统 ==============运行环境======== 系统:windows git : Git-1.7.3.1-preview20101002.rar  下载地址:http ...

  10. Linux下好玩的命令

    1.yes命令,输出很多个y,可以用来对付选择很多y/n的应用. 2.banner命令,打印字符标题,就是用字符拼出大字来: 3.ddate命令,把日历转换成其他的什么历: 4.fortune命令,随 ...