Easy · Arrays
Move all zeros to end
Given an integer array nums, move every 0 to the end in place so that the non-zero values keep their original relative order; return nothing.
Examples
Example 1
[0,1,0,3,12]Output: [1,3,12,0,0]
Example 2
[4,0,0,5,0,6]Output: [4,5,6,0,0,0]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.