← 返回 jpmorgan 的题目列表Interval Consolidation OA
类型:qbank
The OA used the original LeetCode Merge Intervals prompt: given intervals, merge all overlapping intervals and return the consolidated list. It was paired with the prerequisite-cycle OA in the same assessment.
Requirements
Given a list of intervals, merge all overlapping intervals.
Return the resulting non-overlapping intervals after consolidation.
Sort order should be made explicit; the standard version returns intervals sorted by start after merging.
Use standard Merge Intervals overlap semantics unless the OA states otherwise.
Notes
Clarify whether touching endpoints count as overlapping. In the standard version, [1,4] and [4,5] merge.
Sort by start time first, then keep a running merged interval.
This appeared as one of two OA questions in a 60-minute, non-camera HackerRank-style assessment.
Preparation
Implement the sort-and-scan version until it is mechanical.
Test unsorted intervals, nested intervals, adjacent endpoints, a single interval, and no intervals if the platform allows empty input.