Move Zeroes

Easy
ArrayTwo PointersMicrosoftMeta
Move every zero to the end of the array while preserving the relative order of nonzero values. Print the final array. Input format: - First line: n - Second line: n integers

Constraints

1 <= n <= 10^5
-10^9 <= nums[i] <= 10^9

Sample tests

Sample 1

Sample 2

Sign in to submit