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