Merge two arrays into one.
Difficulty: Easy
Phase: 6 · Mixed Logical Challenges
XP Reward: 10 XP
Topics: Mixed Logical Challenges, Easy
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Given N integers, move all zeroes to the end while maintaining relative order of non-zero elements. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 6 0 1 0 3 12 0
Output: 1 3 12 0 0 0
Explanation: Sample execution for input 6 0 1 0 3 12 0