```
class Solution(object):
def maxSubArray(self, a):
cur_sum, mx_sum = 0, float('-inf')
for n in a:
cur_sum+=n
if cur_sum > mx_sum:
mx_sum = cur_sum
if cur_sum <= 0:
cur_sum = 0
return mx_sum
```