FastPrepMerge Overlapping Closed Intervals
Problems/Merge Overlapping Closed Intervals

Merge Overlapping Closed Intervals

Applied Intuition logoApplied Intuition● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report explicitly identifies the disguised coding problem as merge intervals but does not preserve its wrapper. The conventional closed-interval contract matches that recognizable seed at about 88%.

Given closed integer intervals [start, end], merge every pair that overlaps or touches at an endpoint. Return disjoint intervals sorted by start.

Function

mergeIntervals(intervals: int[][]) → int[][]

Examples

Example 1

intervals = [[1,3],[2,6],[8,10],[10,12]]return = [[1,6],[8,12]]

The first two overlap and the last two touch at 10.

Example 2

intervals = [[5,7]]return = [[5,7]]

One interval is already merged.

Example 3

intervals = [[4,5],[1,10],[2,3]]return = [[1,10]]

The containing interval absorbs both others.

Constraints

  • 1 <= intervals.length <= 10^5.
  • -10^9 <= start <= end <= 10^9.

More Applied Intuition problems

  • Hash Map with Separate ChainingONSITE INTERVIEW · Seen Nov 2026
  • KV Store with Nested TransactionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Parse Nested Message TypesPHONE SCREEN · Seen Nov 2026
All Applied Intuition interview questionsSee Applied Intuition hiring insights
Saved
class Solution {
    public int[][] mergeIntervals(int[][] intervals) {
        // Write your solution here.
    }
}
Checking account…