阅读量:0
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(nums.size() == 1)
return 1;
vector<int>::iterator it = nums.begin();
vector<int>::iterator it1 = it;
it1++;
while(it!= nums.end())
{
while(it1!=nums.end() && *it1 == *it)
{
it1++;
}
it = nums.erase(++it,it1);
it1 = it;
it1++;
}
return nums.size();
}
};