After compacting [0, 1, 0, 3, 12], what remains to do?
Practice this question from Move Zeroes - Two pointers Pattern Practice Quiz, with options and an explanation.
Question
After compacting [0, 1, 0, 3, 12], what remains to do?
Option A
Sort the array
Option B — Correct answer
Fill the remaining tail with zeroes
Option C
Reverse the array
Option D
Remove all zeroes from memory
Explanation
Fill the remaining tail positions with zeroes.