class Solution {
public:
/**
* @param A: a list of integers
* @return : return an integer
*/
int removeDuplicates(vector<int> &nums) {
// write your code here
if(nums.empty())
{
return 0;
}

int n = nums.size(), m=0;

for(int i=1;i<n;++i)
{
if(nums[i] != nums[m])
{
nums[++m] = nums[i];
}
}
nums.resize(m+1);
return m+1;
}
};