rhea0110 / move-the-elements Goto Github PK
View Code? Open in Web Editor NEWWrite 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: 7 13 10 15 5 2 -6 -8 -9 -1