← Microsoft questions

Move zeros to end of array in single scan

Filed under Microsoft

Given an array of integers, move all zeros to the end while maintaining the relative order of non-zero elements, using O(1) extra space and a single pass.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.