When should the running subarray start fresh?

Practice this question from Maximum Subarray - Kadane Pattern Practice Quiz, with options and an explanation.

Question

When should the running subarray start fresh?

Option A — Correct answer

When current value alone beats current plus value

Option B

Only when the value is positive

Option C

Only at index 0

Option D

Never; always extend

Explanation

Start fresh when the current value alone is better than extending the previous sum.

Maximum Subarray - Kadane Pattern Practice Quiz

All questions · Previous question

Open on QuizMaker