/**
* @param {number[]} nums
* @return {number}
*/
var removeDuplicates = function(nums) {
var index = 0;
var last = 200;
for(const num of nums) {
if (num != last) {
nums[index] = num;
index++;
}
last = num;
}
return index;
};
No comments:
Post a Comment