You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a function moveElements which receives an array of n elements (both positive and negative) as input and shift all the negative elements to the right side of the array while maintaining the original order of the positive and negative elements.
Note: consider 0 as a positive element.
Suppose the array contains the following values:
-6 7 13 10 -8 15 5 -9 2 -1
After a call to moveElements(arr, n); the array should store the following values: