You are viewing a single comment's thread. Return to all comments →
A bit less efficient, but more readable
def arrayManipulation(n, queries): a = [0] * (n + 1) for q in queries: a[q[0] - 1] += q[2] a[q[1]] -= q[2] for i in range(1, len(a)): a[i] += a[i-1] return max(a)
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
A bit less efficient, but more readable