LEARNING JOURNAL

I created this learning journal to practice writting and to help me learn by writting everything down. Source code here

2/29/2024

Maximum Subarray - Kadane's algorithm

THE PROBLEM

This is the approach using Kadane's algorithm, in which we keep the running sum (maxEndingHere), this variable will be the max sum of all subarray that ends at i. If that sum is negative, the subarray has no use for all array suffix it, so we reset maxEndingHer to 0.