Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
Array
Move Zeroes
Move all zeros to the end while maintaining relative order of non-zero elements in-place.
Examples
Input:
nums = [0,1,0,3,12]
Output:
[1,3,12,0,0]
Sample Test Cases
Case 1 Input:
[0,1,0,3,12]
Expected:
[1,3,12,0,0]
Case 2 Input:
[0]
Expected:
[0]
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
[0,1,0,3,12]
Expected:
[1,3,12,0,0]
Case 2 Input:
[0]
Expected:
[0]