Max Array Sum

  • + 0 comments

    Bumping the solution from about 6 years ago, Python3

    def maxSubsetSum(coll):
        a,b = -math.inf,-math.inf
        for val in coll:
            a,b = b, max(a, a + val, b, val) 
        return b