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