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