Why is checking every subarray too expensive?
Practice this question from Maximum Subarray - Kadane Pattern Practice Quiz, with options and an explanation.
Question
Why is checking every subarray too expensive?
Option A
It uses recursion
Option B — Correct answer
It checks many start/end ranges
Option C
It cannot handle positives
Option D
It always uses O(1) time
Explanation
There are many start/end combinations, which leads to O(n^2) work.