Why is the brute-force approach less ideal here?
Practice this question from Sort Colors - Dutch National Flag Pattern Practice Quiz, with options and an explanation.
Question
Why is the brute-force approach less ideal here?
Option A — Correct answer
Counting works but needs separate counting and overwrite passes.
Option B
It is always O(1)
Option C
It avoids all comparisons
Option D
It only works for binary trees
Explanation
Counting works but needs separate counting and overwrite passes.