Skip to content

#283 - Move Zeroes

EasyTwo Pointers
Open on LeetCode

Given an integer array nums, move all 0's to the end while maintaining the relative order of the non-zero elements. You must do this in-place without making a copy of the array.

InputOutput
nums = [0,1,0,3,12][1,3,12,0,0]
nums = [0][0]
nums = [1,2,3][1,2,3]

Released under the MIT License.