def linear_max_sum(self, A):
        ret = Sum(A[0], 0, 0)

        cur = 0  # current sum
        s = 0
        for e, v in enumerate(A):
            cur += v
            if ret.sum < cur:
                ret = Sum(cur, s, e)

            if cur < 0:
                s = e+1
                cur = 0

        return ret
Break at 0
dataset/ETHPy150Open algorhythms/LintCode/Continuous Subarray Sum II.py/Solution.linear_max_sum