1. You are given an array A of size N.
2. You have to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Note: You must do this in-place without making a copy of the array.
3. For example,
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
4. main takes input from the users.
5. This is a functional problem.
6. You have to complete the moveZeroes function. It takes as input an integer array. It should move all the zeroes to the end of the array.Input Format
First line takes input N, the length of the array. Second line takes input N space separated integers, representing the elements of the array. Input is handled for you.
Output Format
The resultant array. Output is handled for you.
Constraints
1 <= N <= 5000
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
5 0 1 0 3 12
Output
1 3 12 0 0