water
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
for(vector<int>::iterator it=nums.begin();it!=nums.end();)
{
int cur=*it;
it++;
while(it != nums.end() && *it == cur)nums.erase(it);
}
return nums.size();
}
};
相关文章
- 12-05【Leetcode】Remove Duplicates from Sorted List II
- 12-05[leetcode]Remove Duplicates from Sorted Array II @ Python
- 12-05LeetCode::Remove Duplicates from Sorted List II [具体分析]
- 12-05[LeetCode] Remove Duplicates from Sorted List II
- 12-05leetcode 26 Remove Duplicates from Sorted Array
- 12-0511 Remove Duplicates from Sorted Array II
- 12-05remove-duplicates-from-sorted-list
- 12-05LeetCode 26 Remove Duplicates from Sorted Array
- 12-05leetcode专题训练 26. Remove Duplicates from Sorted Array
- 12-05【LeetCode记录帖】【4】Remove Duplicates from Sorted Array