class Solution {
public:
/**
* @param A: a list of integers
* @return : return an integer
*/
int removeDuplicates(vector<int> &nums) {
// write your code here
int length=nums.size();
if(nums.empty())
{
return 0;
}
int n=0;
for(int i=0;i<length;i++)
{
if(nums[i]!=nums[n])
{
n++;
nums[n]=nums[i];
}
}
nums.resize(n+1);
return n+1;
}
};