Back to exercises

Maximum Subarray

Track the best subarray ending at the current position and reset only when starting fresh is better than extending the previous run.

Coding Exercises Medium O(n)

Maximum Subarray

Track the best subarray ending at the current position and reset only when starting fresh is better than extending the previous run.

Return the largest possible sum of a contiguous subarray.