Not Accepted but Works on my computer


  • 0
    Y

    This is my program:

    /**
    
    • @param {number[]} nums
    • @param {number} val
    • @return {number}
      */
      var removeElement = function(nums, val) {
      if(nums.length === 0) return nums;
      else{
      return nums.filter(function(x){return x != val;});
      }
      };

Log in to reply
 

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