Search
⌘K

Leetcode 283. Move Zeroes

Rearrange the array in-place so all zeros are moved to the end while preserving the relative order of non-zero elements, without using extra storage. Aim to minimize the number of writes/operations (stable partition / two-pointer pattern).

Asked at:

Meta

Microsoft

Microsoft


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late October, 2025

Microsoft

Microsoft

Mid-level

Late January, 2025

Meta

Senior

Q1) https://leetcode.com/problems/move-zeroes/description/ Followup: a) Move all zeros to the start of the array while maintaining the relative order of other numbers. b) Move all zeros to the start, negative numbers to the middle, and positive numbers to the end. The order within negative elements can be out of order. And the same for positive elements. This is similar to the Leetcode sort colors problem.

Early November, 2024

Meta

Mid-level

Move Zeroes - Move all zeroes to the end of the array while maintaining the relative order of non-zero elements

Comments

Your account is free and you can post anonymously if you choose.