admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Remove all negative number of an array

Suraj Ghimire
13 Posts

Given an array of Integer,where it contains all +ve and -ve number, remove all -ve number from an array.

 

Example:

Input:

arr={1,2,3,-11,4,5,-15}

 

Output:

{1,2,3,4,5,0,0} 

 

Explaination: 

All -ve number was removed and positive numbers were shifted one position left.

The left over is filled up with 0

Published By : Suraj Ghimire
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin