You are viewing a single comment's thread. Return to all comments →
My solution
def maximumSum(a, m): a = list(map(lambda x:x%m,itertools.accumulate(a))) maxi = max(a) arr = [] for i in a: bisect.insort(arr,i) if i!=arr[-1]: maxi = max(maxi,(i-arr[bisect.bisect_right(arr,i)])%m) return maxi
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Subarray Sum
You are viewing a single comment's thread. Return to all comments →
My solution