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.
Examples
01 · Example 1
starts = [4, 2, 7, 8] durations = [3, 2, 3, 2] costs = [7, 3, 1, 2] return = 9
Reason :
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
- Count Promotional PeriodsOA · Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Get Minimum AmountOA · Seen Jun 2026
- Find Minimum CostOA · Seen Jun 2026
- Get Smallest Base SegmentOA · Seen Jun 2026
- Select Least Resource TasksOA · Seen Jun 2026
- Product Category Group SizesPHONE SCREEN · Seen May 2026
- Count Connected ComponentsPHONE SCREEN · Seen May 2026
public int maxSumNonOverlappingIntervals(int[] starts, int[] durations, int[] costs) {
// write your code here
}
starts[4, 2, 7, 8]
durations[3, 2, 3, 2]
costs[7, 3, 1, 2]
expected9
sign in to submit