Why is the temporary-list approach less ideal?
Practice this question from Move Zeroes - Two pointers Pattern Practice Quiz, with options and an explanation.
Question
Why is the temporary-list approach less ideal?
Option A
It changes the answer
Option B — Correct answer
It uses O(n) extra space
Option C
It cannot handle arrays with zeroes
Option D
It is slower than O(n^2)
Explanation
It uses O(n) extra space, while the expected solution is in-place.