[Amazon] INTERN ONLINE ASSESSMENT 2024-12-25

A Supply Chain Manager at an Amazon warehouse is reviewing the logs of when trucks arrived and departed from their warehouse.

Please help them with their review by completing the following challenge:
Given a collection of time intervals, [start, end], merge and return the overlapping intervals sorted in ascending order of their start times.


Function Description

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

Example 1:

Input:
intervals = [[7, 7], [2, 3], [6, 11], [1, 2]]

Output:
[[1, 3], [6, 11]]

Explanation:
The interval [1, 2] merges with [2, 3] while [7, 7] merges with [6, 11].
There are no more overlapping intervals. The answer is [[1, 3], [6, 11]].


Constraints:

  • 1 ≤ n ≤ 10^5
  • 1 ≤ intervals[i][2] ≤ 10^9
  • intervals[i][0] ≤ intervals[i][1] for all i.

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *