FastPrepPeak Resource Usage Across Weighted Intervals
Problems/Peak Resource Usage Across Weighted Intervals

Peak Resource Usage Across Weighted Intervals

Tekion logoTekion● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported task identifies this algorithmic exercise. The executable interface, bounds, deterministic tie rules, and examples are the documented practice contract.

Each half-open interval [start, end) consumes a positive number of resources while active. Return the maximum total resource usage at any instant.

An interval ending at time t is inactive before an interval starting at t is counted.

Function

peakResourceUsage(intervals: int[][], resources: int[]) → int

Examples

Example 1

intervals = [[1,4],[3,5],[4,6]]resources = [3,2,4]return = 6

Case 1 exercises the documented deterministic contract.

Example 2

intervals = [[0,1]]resources = [7]return = 7

Case 2 exercises the documented deterministic contract.

Example 3

intervals = [[1,2],[2,3]]resources = [5,9]return = 9

Case 3 exercises the documented deterministic contract.

Constraints

  • 1 <= intervals.length == resources.length <= 200000.
  • 0 <= start < end <= 10^9.
  • The total active resource count fits a signed 32-bit integer.

More Tekion problems

  • Largest Rectangle in HistogramONSITE INTERVIEW · Seen Sep 2026
  • Next Greater Element to the RightONSITE INTERVIEW · Seen Sep 2026
  • Dungeon GamePHONE SCREEN · Seen Sep 2026
All Tekion interview questionsSee Tekion hiring insights
Saved
class Solution {
    public int peakResourceUsage(int[][] intervals, int[] resources) {
        // Write your code here.
    }

}
Checking account…