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

Move all negative numbers to beginning and positive to end with constant extra space

An array contains both positive and negative numbers in random order. Rearrange the array elements so that all negative numbers appear before all positive numbers.
Examples : 

Input: {-12, 11, -13, -5, 6, -7, 5, -3, -6}
Output: {-12 -13 -5 -7 -3 -6 11 6 5}

Note: Order of elements is not important here.
Published By : Shazia Irfan Bebal
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin