Medium · Prefix Sum
Array Manipulation
Given n (an array of n zeros, indexed 1..n) and m queries [a, b, k] that each add k to every position from a to b inclusive, return the largest value in the array after all queries are applied.
Examples
Example 1
n=5, 3 queriesOutput: max = 200
Example 2
n=8, 3 queriesOutput: max = 10
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.