awelgorithms

Move Zeroes: the skills you need first

Updated

LeetCode · easy · arrays. Write pointer keeps the next non-zero. Zeros fill the tail.

open on LeetCode

Skills this problem builds on

Stuck on Move Zeroes? It is usually one of these. Get each one solid and the solution stops being a trick.

  1. Move zeros to end
  2. Move zeros preserving order
  3. Maintain write index
check which ones you have 10 minutes, free, no account.

More arrays problems