We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
maxVal = -2**32
arr = [0] * n
for a, b, k in queries:
arr[a-1] += k
if(b < n): arr[b] -= k
currSum = 0
for num in arr:
currSum += num
if(currSum > maxVal): maxVal = currSum
return maxVal
Cookie support is required to access HackerRank
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 →
Same algorithm in Python: