Problem · Intervals
Max Sum of Non-Overlapping Intervals
Learn this problemProblem statement
AMZ Interval Collection (A group of problems focused on operations involving intervals :) -
1. Get Maximum Sum Find Overlapping Times (Full-Time)
2. Find Overlapping Times (Intern)
3. Merge Intervals (Intern, NG)
5. Optimal Interval Difference
Given 3 arrays -
Some intervals might overlap. Find the maximum sum of Non-Overlapping intervals.
Function
maxSumNonOverlappingIntervals(starts: int[], durations: int[], costs: int[]) → intExamples
Example 1
starts = [4, 2, 7, 8]durations = [3, 2, 3, 2]costs = [7, 3, 1, 2]return = 9Reason :
Based on the given data, the intervals are [2,4], [4,7], [7,10] and [8,10]
Non overlaping intervals are: [2,4],[7,10] and [4,7],[8,10]
Considering [2,4] + [7,10] = 3 + 1 = 4,
Considering [4,7] + [8,10] = 7 + 2 = 9
Answer is 9.
More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026