Quiz question placeholder with incorrect complexity. This will be filled with a proper quiz question. Time: . Space: . The placeholder ensures the unit structure remains intact while the quiz content is developed separately from the main flow.
Greedy Algorithms8 sections · 316 units
Open in CourseQuiz: Kadane's Algorithm
Understanding the reset
Check Your Understanding
In Kadane's algorithm, why do we reset currentSum to 0 when it becomes negative?
- A.To handle edge cases with all negative numbers
- B.To save memory
- C.Because a negative prefix would only decrease any future subarray sum
- D.To ensure the algorithm runs in linear time