0

I am unable to solve this problem related array and c++, please anyone tell me steps to solve this?

Write a program to shift all the zero present in the array in the alternative order, For example. Input array: - 1 2 0 8 5 0 0 6 Output array: - 1 0 2 8 0 5 0 6 Sample Input: First input should describe the number of elements in the array and in the second line take all the input. 5 0 1 2 0 3 Output: - 1 0 2 0 3

2nd Mar 2021, 1:43 PM
KAUSHAL KUMAR
KAUSHAL KUMAR - avatar
1 Réponse
0
For this example below 5 0 1 2 0 3 Which outputs 1 0 2 0 3 Why the second zero (near 3) isn't being moved? Also what happens when there are adjacent zeroes in the array e.g. 2 0 7 0 0 5 8 0 9
3rd Mar 2021, 7:14 AM
Ipang