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