```
class Solution:
# @param A, a list of integers
# @return an integer
def maxSubArray(self, A):
maximum = float("-inf")
allsum = 0
ptr = 0
while ptr < len(A):
allsum += A[ptr]
if allsum > maximum: maximum = allsum
if allsum < 0: allsum = 0
ptr += 1
return maximum
```