leetcode 80: Remove Duplicates from Sorted Array II
来源:互联网 发布:手游网络加速器排行 编辑:程序博客网 时间:2024/06/06 07:09
class Solution {public: int removeDuplicates(vector<int>& nums) { map<int,int> mp; int len=nums.size(); for(int i=0;i<len;i++) { if(mp.find(nums[i])==mp.end()) mp[nums[i]]=1; else if(mp[nums[i]]==1) mp[nums[i]]++; else if(mp[nums[i]]==2) { for(int j=i+1;j<len;j++) nums[j-1]=nums[j]; len--; i--; } } return len; }};
0 0
- LeetCode-Array-80 Remove Duplicates from Sorted Array II
- LeetCode: Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted Array II
- LeetCode: Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted Array II
- [LeetCode] Remove Duplicates from Sorted Array II
- [leetcode] Remove Duplicates from Sorted Array II
- [LeetCode]Remove Duplicates from Sorted Array II
- [leetcode]Remove Duplicates from Sorted Array II
- LeetCode-Remove Duplicates from Sorted Array II
- [leetcode] Remove Duplicates from Sorted Array II
- LeetCode - Remove Duplicates from Sorted Array II
- LeetCode:Remove Duplicates from Sorted Array II
- LeetCode | Remove Duplicates from Sorted Array II
- Leetcode: Remove Duplicates from Sorted Array II
- 【leetcode】Remove Duplicates from Sorted Array II
- Leetcode: Remove Duplicates from Sorted Array II
- [LeetCode] Remove Duplicates from Sorted Array II
- Linux(centos)下mysql编译安装教程
- Android SDK离线下载安装
- Struts 2中的constant详解
- “Error setting expression 'id' with value '[Ljava.lang.String;@e41d4a'”解决办法!
- 安卓设计架构
- leetcode 80: Remove Duplicates from Sorted Array II
- nova.conf及其他配置
- 《数据库系统概念》学习笔记之二
- 位图应用
- Remove Nth Node From End of List
- jsp:跳转后页面css和js失效问题解决
- ui->setup(this); shortcut can't show
- Android studio新建工程时报错:Gradle DSL method not found: 'android()'问题解决
- 面试知识储备:新浪微博Android客户端的实现