JavaScript Implementation


  • 0
    T
     * @param {number[]} nums
     * @param {number} val
     * @return {number}
     */
    var removeElement = function(nums, val) {
        while(nums.includes(val)){
            nums.splice(nums.indexOf(val), 1);
        }
        return nums.length;
    };

Log in to reply
 

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