Find Overlapping Times
Learn this problemProblem statement
AMZ Interval Collection (A group of problems focused on operations involving intervals :) -
1. Find Overlapping Times (Intern)
2. Get Maximum Sum Find Overlapping Times (Full-Time)
3. Merge Intervals (Intern, NG)
5. Optimal Interval Difference
At an Amazon warehouse, trucks follow scheduled arrival and departure times. Each truck's timeframe is represented as an interval [arrival, departure], where it marks when the truck entered and exited the facility.
Due to operational overlaps, some intervals may intersect, meaning multiple trucks were at the warehouse at the same time. To simplify the records, overlapping intervals should be merged into a single continuous time block.
Your task is to process a list of time intervals, merge any overlapping ones, and return the final set of intervals sorted in ascending order of arrival times.
Function
findOverlappingTimes(intervals: int[][]) → int[][]
Complete the function findOverlappingTimes in the editor.
findOverlappingTimes has the following parameter(s):
int intervals[[n][2]]: the time intervals
Returns
int[][2]: the merged intervals in sorted order
Examples
Example 1
intervals = [[7, 7], [2, 3], [6, 11], [1, 2]]return = [[1, 3], [6, 11]]Constraints
More Amazon problems
- Resolve Task DependenciesONSITE INTERVIEW · Seen Jul 2026
- Shortest Distance on a Circular Bus RouteOA · Seen Jul 2026
- Longest Increasing Subsequence With Bounded Adjacent DifferenceONSITE INTERVIEW · Seen Jul 2026
- Search in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Jul 2026
- Sliding Window MaximumONSITE INTERVIEW · Seen Jul 2026
- Merge IntervalsOA · Seen Jul 2026
- Sort Bug Report FrequenciesOA · Seen Jul 2026
- Drone Delivery RouteOA · Seen Jul 2026