114ms JavaScript solution


  • 0
    V
    var removeElement = function(nums, val) {
        var count = 0;
        var start = 0;
    
        for(i=0; i<nums.length; i++){
    
            if(nums[i] == val) {
                nums.splice(i,1);
                i--;
            }
    
        }
    
    };

Log in to reply
 

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