class Solution {
public: int removeDuplicates(vector<int>& nums) {
if(nums.size() == 0) return 0;
int dup = nums[0];
int end = 1;
for(int i = 1; i < nums.size(); i++){
if(nums[i]!=dup){
nums[end] = nums[i];
dup = nums[i];
end++;
}
}
return end;
}
};
public: int removeDuplicates(vector<int>& nums) {
if(nums.size() == 0) return 0;
int dup = nums[0];
int end = 1;
for(int i = 1; i < nums.size(); i++){
if(nums[i]!=dup){
nums[end] = nums[i];
dup = nums[i];
end++;
}
}
return end;
}
};