You are viewing a single comment's thread. Return to all 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
Seems like cookies are disabled on this browser, please enable them to open this website
Max Array Sum
You are viewing a single comment's thread. Return to all comments →
Bumping the solution from about 6 years ago, Python3