Question: https://oj.leetcode.com/problems/maximum-subarray/

Question Name: Maximum Subarray

This problem is a classic one.

1 2 3 4 5 6 7 8 9 | class Solution: # @param A, a list of integers # @return an integer def maxSubArray(self, A): max_so_far = max_ending_here = A[0] for item in A[1:]: max_ending_here = max(item, max_ending_here + item) max_so_far = max(max_ending_here, max_so_far) return max_so_far |