#14 - Filter Elements from Array

Write a program to filter given numbers array by removing negative numbers.

Example 1

Input:

arr = [12, -5, 8, -2, 17, -9]

Output:

[12, 8, 17]

Example 2

Input:

arr = [-12, 5, -8, 2, -17, 9]

Output:

[5, 2, 9]

Last updated