Java 8 - Using Streams. 2 Lines of code - Works. but this site says it does NOT, WHY?


  • -1
    W
     public int removeElement(int[] nums, int val) {
            
             nums = IntStream.of(nums).boxed().filter(u -> !u.equals(Integer.valueOf(val))).mapToInt(v->v).toArray();
    		 return nums.length;
            
        }

Log in to reply
 

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