def merge(intervals: list[list[int]]) -> list[list[int]]:
The round: Merge Intervals (LeetCode 56) in onsite rounds. Four reports between November 2025 and April 2026. Three name LeetCode 56 as asked, one of them in a Microsoft AI loop. A hiring-event round asked a variant: output every interval that overlaps. That candidate expected to sort and scan. Two graded parts: the merge, then the variant. They were reported as separate problems; no report asks the variant after LeetCode 56, so putting them on one page is our choice.
Intervals are [start, end] lists of ints with start <= end.
Part 1 — merge overlapping intervals (LeetCode 56)
def merge(intervals: list[list[int]]) -> list[list[int]]: ...
[1,4] and [4,5]) overlap. The input may be unsorted.Notes: the report gives the variant in one line ("output all the overlapping intervals"), so this page reads it as the intervals that overlap some other interval. Two other readings exist: every overlapping pair, or the overlapping stretches themselves (the intersections). Ask which one is wanted; the first is sketched below as an ungraded variant. Whether touching intervals count in Part 2 is not reported. The reference counts them, as Part 1 does, and no Part 2 test has intervals that only touch. The output order in Part 2 is ours; the tests sort before comparing. The function names are ours.
Four onsite reports, none with a result. Two list LeetCode 56 as the problem, asked as written, in loops where other rounds were LeetCode 64 or LeetCode 235 with a not-a-BST follow-up. A Microsoft AI (MAI) loop of six rounds had LeetCode 146 and LeetCode 56 as its two coding rounds, and readers noted that its design questions matched OpenAI's. The variant comes from a four-round hiring event where each coding round spent its first 15 to 20 minutes on behavioral and resume questions; the fourth round was LeetCode 56 changed to output every overlapping interval. The candidate thought sorting, one scan, then merging was the way, and the round before it required running tests.
Also reported as LeetCode 56
The round: Merge Intervals (LeetCode 56) in onsite rounds. Four reports between November 2025 and April 2026. Three name LeetCode 56 as asked, one of them in a Microsoft AI loop. A hiring-event round asked a variant: output every interval that overlaps. That candidate expected to sort and scan. Two graded parts: the merge, then the variant. They were reported as separate problems; no report asks the variant after LeetCode 56, so putting them on one page is our choice.
Intervals are [start, end] lists of ints with start <= end.
Part 1 — merge overlapping intervals (LeetCode 56)
def merge(intervals: list[list[int]]) -> list[list[int]]: ...
[1,4] and [4,5]) overlap. The input may be unsorted.Part 2 — every interval that overlaps another
def overlapping_intervals(intervals: list[list[int]]) -> list[list[int]]: ...
[[1,3],[2,6],[8,10],[15,18]] the answer is [[1,3],[2,6]].Notes: the report gives the variant in one line ("output all the overlapping intervals"), so this page reads it as the intervals that overlap some other interval. Two other readings exist: every overlapping pair, or the overlapping stretches themselves (the intersections). Ask which one is wanted; the first is sketched below as an ungraded variant. Whether touching intervals count in Part 2 is not reported. The reference counts them, as Part 1 does, and no Part 2 test has intervals that only touch. The output order in Part 2 is ours; the tests sort before comparing. The function names are ours.
Variant: instead of merging, output every interval that overlaps.
| Approach | Notes |
|---|---|
| For the variant, merge while recording which original intervals form each group, then return the members of groups with two or more intervals. | — |
Common mistakes: Not sorting first, or replacing the merged end instead of taking the larger one. In the variant, checking each interval only against its sorted neighbour: a long interval can overlap one several places later.
What candidates did: The candidate who got the variant planned to sort, scan once, then merge. In the round before it, they had to run tests.
Edge cases to test: Touching intervals ([1,4], [4,5]). One interval containing others. Unsorted input. A single interval. In the variant: an interval that overlaps nothing, and two copies of the same interval.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 39 Microsoft questions, refreshed monthly from new candidate reports.