Checkpoint: filter into a new array
Challenge on lesson: Checkpoint: arrays
CHALLENGE
Difficulty: beginner+25 XP
Implement int[] trimNegatives(int[] arr): return a new array holding only the non-negative elements of arr, in their original order. Two passes make it clean: first count them, then fill.
Press Submit to check your solution.
Back to lesson: Checkpoint: arrays