Why is the brute-force approach less ideal here?

Practice this question from Segment Tree - Range Sum Query Pattern Practice Quiz, with options and an explanation.

Question

Why is the brute-force approach less ideal here?

Option A — Correct answer

Scanning each query range costs O(n).

Option B

It always uses no memory

Option C

It avoids all state changes

Option D

It only works for binary search

Explanation

Scanning each query range costs O(n).

Segment Tree - Range Sum Query Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker