Problem

6/10

Removing elements

Theory Click to read/hide

You can remove elements in an ArrayList using the remove method in two ways:

  • by index remove(index)
  • by value remove(value)
For example:
 
arr.remove(0); //removes the first element
arr.remove(< strong>new Integer(10)); //deletes element with value 10

Problem

Given an array of N elements (\(2<=N<=15\)). Remove all negative elements from it.
 
Input:
- the input is given in the first line N - the number of array elements;
- the second line contains N numbers - the values ​​of the array elements.

Output: print the resulting array to a string.
 
Examples
# Input Output
1
5
43  -56  76  -84 100 
43 76 100