LeetCode
Maximum Subarray
Click
here
for an explanation.