simple javascript solution


  • 0
    B
    var removeElement = function(nums, val) {
        var temp = 0;
        for(let k of nums) if(k !== val) nums[temp++] = k;
        return temp;
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.