Given an list a containing equal number of positive and negative elements, arrange the list such that every positive element is followed by a negative element.
Note- The relative order of positive and negative numbers should be maintained.
Example 1:
Input:
N = 6
a = [-1, 2, -3, 4, -5, 6]
Output:
2 -1 4 -3 6 -5
Explanation: Positive numbers in order are 2, 4 and 6. Negative numbers in order are -1, -3 and -5. So the arrangement we get is 2, -1, 4, -3, 6 and -5.
Example 2:
Input:
N = 4
a = [-3, 2, -4, 1]
Output:
2 -3 1 -4