Reported October 2026
FurtherAIsorting

Merge Overlapping Intervals

Reported by candidates from FurtherAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live FurtherAI OA. Under 2s to a working solution.
Founder's read

FurtherAI reportedly put Merge Overlapping Intervals in front of candidates in October 2026, and the whole solution hinges on one array: the intervals sorted by start. Once they're sorted, overlaps only happen between neighbors, and a single pass finishes the job. It's a classic, so the interviewers expect it clean and fast. The twist worth noting is that touching endpoints count as overlap, so [1,4] and [4,5] become [1,5]. If your brain freezes mid-OA, StealthCoder sits invisibly on your desktop and hands you the working solution in real time. Know the pattern first, though.

The problem

Given a non-empty array of closed intervals, merge every pair of intervals that overlaps and return the non-overlapping merged intervals in ascending start order.
Intervals that touch at one endpoint overlap. For example, [1,4] and [4,5] merge into [1,5].

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

Examples
Example 1
intervals = [[1,3],[2,6],[8,10],[15,18]]
return = [[1,6],[8,10],[15,18]]
The first two intervals overlap and merge; the other intervals remain separate.
Example 2
intervals = [[1,4],[4,5]]
return = [[1,5]]
Closed intervals that share endpoint 4 overlap.

Constraints
1 <= intervals.length <= 10^5.
intervals[i].length == 2.
-10^9 <= intervals[i][0] <= intervals[i][1] <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Sort the intervals by start. Then keep a result list. For each interval, compare its start to the end of the last merged interval. If start <= lastEnd, they overlap, so set lastEnd to max(lastEnd, currentEnd). Otherwise push a new interval. That's O(n log n) for the sort and O(n) for the scan. The pitfalls are predictable. Using < instead of <= breaks the touching-endpoint case from Example 2. Forgetting max means [1,10] followed by [2,3] shrinks to [1,3]. Mutating the input without copying can bite too. With n up to 10^5 and values to 10^9, don't use any approach that marks every integer point on a number line. If you blank on the live OA, StealthCoder is the hedge that surfaces this sort-and-sweep outline while you type.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Merge Overlapping Intervals cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as merge intervals. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass FurtherAI's OA.

FurtherAI reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Merge Overlapping Intervals FAQ

What's the trick in Merge Overlapping Intervals?+

Sort by start, then sweep once. Compare each interval's start to the end of the last merged one. If start is less than or equal to that end, extend the end with max. Otherwise start a new interval. Sorting is what makes neighbor comparison enough.

How hard is this problem really?+

It's a medium on paper, but it's one of the most common interval questions. If you've seen sort-then-sweep once, it takes about ten minutes. The only real traps are the touching-endpoint rule and forgetting max when extending the end.

Do touching intervals like [1,4] and [4,5] merge?+

Yes. The problem says closed intervals that share an endpoint overlap, so the result is [1,5]. Use start <= lastEnd in your comparison. Using strict less-than is the most common wrong answer and it fails Example 2 immediately.

What's the time complexity I should state?+

O(n log n) time from sorting, and O(n) extra space for the output list. The merge pass itself is linear. With up to 10^5 intervals that's comfortable. Say it out loud if there's a verbal component, because interviewers like hearing the sort dominates.

How do I prepare for this in 48 hours?+

Write the sort-and-sweep solution from memory twice. Test it on [[1,4],[4,5]], a fully nested case like [[1,10],[2,3]], and a single interval. Then glance at insert interval and meeting rooms, since they use the same sorted-by-start idea.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with FurtherAI.

OA at FurtherAI?
Invisible during screen share
Get it