Leetcode link: https://leetcode.com/problems/maximum-subarray/
Given a list of integers, find the continguous subarray which gives the largest sum of the integers and return the sum.
To find the largest sum of the contiguous subarray, we can use Kadane's algorithm. The algorithm looks like this:
To understand why Kadane's algorithm works, check out this video: