leetcode刷题,总结,记录,备忘26
来源:互联网 发布:羽绒被牌子 知乎 编辑:程序博客网 时间:2024/06/05 09:53
leetcode26Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given input array nums = [1,1,2]
,
Your function should return length = 2
, with the first two elements of nums being 1
and 2
respectively. It doesn't matter what you leave beyond the new length.
class Solution {public: int removeDuplicates(vector<int>& nums) { vector<int>::iterator it = unique(nums.begin(), nums.end()); nums.erase(it, nums.end()); return nums.size(); }};
0 0
- leetcode刷题,总结,记录,备忘26
- leetcode刷题。总结,记录,备忘 104
- leetcode刷题。总结,记录,备忘 100
- leetcode刷题。总结,记录,备忘 191
- leetcode刷题。总结,记录,备忘。168
- leetcode刷题, 总结,记录,备忘 171
- leetcode刷题 ,总结,记录,备忘。144
- leetcode刷题,总结,记录, 备忘 141
- leetcode刷题,总结,记录,备忘。116
- leetcode刷题,总结,记录,备忘。96
- leetcode刷题。记录,总结,备忘。217
- leetcode 刷题, 总结,记录,备忘 35
- leetcode刷题,总结,记录,备忘 226
- leetcode刷题,总结,记录,备忘 169
- leetcode刷题,总结,记录,备忘137
- leetcode刷题,总结,记录,备忘83
- leetcode刷题,总结,记录,备忘70
- leetcode刷题,总结,记录,备忘 108
- jvm相关知识整理
- 插入排序——深入浅出(图解)
- 一致性哈希算法及其在分布式系统中的应用
- Flow Problem
- 断点续传
- leetcode刷题,总结,记录,备忘26
- POJ 题目3080 Blue Jeans(KMP+暴力)
- 高效素数打表
- Hdu oj 1874 畅通工程续
- 黑马程序员-[OC语言] 第六篇:foundation框架之 NSString 基本用法
- Linux内核多线程
- Android特色开发_位置与传感器的使用
- 没好域名?就得给自己换个名
- Internet Bandwidth