You are viewing a single comment's thread. Return to all comments →
Using an additional array
def maxSubsetSum(arr): L = [0] * (len(arr) + 1) L[1] = arr[0] for i in range(2, len(L)): L[i] = max(L[i-1], arr[i-1], arr[i-1]+L[i-2]) return max(L)
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 →
Using an additional array