# Free AI LeetCode Communication Coach — Merge Intervals

> Explain Merge Intervals out loud: sort by start, extend or append, how to say O(n log n) time, the 'touching intervals' clarification, and follow-up answers.

- **Page type:** Mini App
- **URL:** https://app.mocklyenglish.com/mini-apps/explain-merge-intervals-in-english
- **Account needed:** No
- **Open the app:** https://app.mocklyenglish.com/mini-apps/explain-merge-intervals-in-english

Mockly English is three things:

1. Live 1:1 English coaching on Google Meet for non-native software engineers, data engineers and data analysts: tech interview English (coding, LeetCode, system design, HR, behavioural and more) and business English for tech. Coaches are practising data engineers who also teach English. Free 30-minute trial, no card needed. Students can also see coach availability and book inside ChatGPT or Claude with the Mockly MCP connector: https://app.mocklyenglish.com/ai, or use the free Mockly English iPhone app: https://app.mocklyenglish.com/mobile-app.
2. Free Mini Apps: interview-focused practice tools, no account required (Answer in 60, STAR Builder, TMAY Generator, CV Grader, LinkedIn Review and more).
3. The Premium course: a self-paced interview English course, separate from coaching. It does not include a session.

## The problem

Given intervals\[i] = \[start, end], merge all overlapping intervals.

Example: intervals = \[\[1,3],\[2,6],\[8,10],\[15,18]] → \[\[1,6],\[8,10],\[15,18]]

Sort first — say it.

```
intervals.sort()
merged = [intervals[0]]
for start, end in intervals[1:]:
    if start <= merged[-1][1]:
        merged[-1][1] = max(merged[-1][1], end)
    else:
        merged.append([start, end])
return merged
```

## How to explain it

1. Restate

   Say the problem in your own words.

   One or two sentences. Show you understood the input, the output, and the goal — not that you memorised the prompt.

2. Approach

   Name the method before you code.

   Brute force first if you need it, then the structure you will use: hash map, two pointers, stack, binary search.

3. Example

   Walk one concrete input.

   Pick small numbers. Say what you store, what you compare, and what you return. Interviewers follow an example more easily than abstract talk.

4. Time and space

   One sentence each.

   After the example, before you claim you are done. “Time is O(n) because we scan once. Space is O(n) for the map.”

5. Edge cases

   Name at least one unusual input.

   Empty input, duplicates, already sorted, overflow. Invite a follow-up: “I would also check …”

- “I sort by start.”
- “If it overlaps I extend the end; else I push a new interval.”

## Practise out loud

3 free scored runs left this hour.

Problem · Medium

Given intervals\[i] = \[start, end], merge all overlapping intervals.

Example: intervals = \[\[1,3],\[2,6],\[8,10],\[15,18]] → \[\[1,6],\[8,10],\[15,18]]

1. 1Restate — Say the problem in your own words.
2. 2Approach — Name the method before you code.
3. 3Example — Walk one concrete input.
4. 4Time and space — One sentence each.
5. 5Edge cases — Name at least one unusual input.

Hit record. Short countdown, then 60–90 seconds. We score the five-step script — never pronunciation.

Recording needs Chrome or Edge. You can still type below.

## Model spoken script (\~75s)

1. Restate

   I need to merge overlapping intervals into a non-overlapping list.

2. Approach

   I sort by start time. I scan once: if the next interval overlaps the current end, I extend the end; otherwise I push a new interval.

3. Example

   On \[1,3] and \[2,6], 2 is not after 3, so I merge to \[1,6]. \[8,10] does not overlap, so I start a new one.

4. Time and space

   Time is O(n log n) from the sort. Space is O(n) for the output.

5. Edge cases

   I would check an empty list and a case where one interval fully contains another.

## How to explain Merge Intervals out loud, step by step

**In one sentence:** You get a list of ranges, each with a start and an end, and have to combine every set of ranges that overlap so the result has no overlaps left.

### What to say, in order

1. “One clarification first: if one interval ends at 4 and the next starts at 4, do they count as overlapping? I'll assume yes.”
2. “I'll sort the intervals by their start value, so any intervals that overlap end up next to each other.”
3. “I start the result with the first interval.”
4. “For each next interval, I compare its start with the end of the last interval in the result.”
5. “If it starts before or at that end, they overlap, so I extend the last interval's end to the maximum of both ends.”
6. “If it starts after that end, there's a gap, so I append it as a new interval. At the end I return the result list.”

### Key English phrases for Merge Intervals

- overlap

  — two intervals share at least one point

- sort by start time

  — the first step that makes a single pass possible

- extend the end

  — merge by moving the last interval's end further

- fully contained

  — one interval sits inside another, like \[1,10] and \[2,3]

- touching intervals

  — one ends exactly where the next begins

### How to say the time and space complexity

“Time is O(n log n), because sorting dominates; the merge pass itself is linear. Space is O(n) for the output, plus whatever the sort uses internally.”

Say which step dominates. 'The merge is O(n), but the sort makes it O(n log n) overall.'

### Communication mistakes on Merge Intervals

- Mistake: Setting the new end to the current interval's end instead of the maximum. Instead: Say 'the maximum of both ends' — it handles an interval that is fully contained in the previous one.
- Mistake: Skipping the touching-intervals question. Instead: Ask it in one sentence before coding. It shows you read the boundaries carefully.
- Mistake: Describing 'compare every interval with every other interval'. Instead: Explain that sorting means you only compare with the last merged interval.

### Likely follow-up questions

- Interviewer: “How would you insert a new interval into a list that's already sorted and merged?”

  You: “I add all intervals that end before the new one starts, then merge every interval that overlaps the new one into it, then add the rest. No sort needed, so it's O(n).”

- Interviewer: “How many meeting rooms would these intervals need?”

  You: “Sort by start and keep a min-heap of end times. For each meeting, if the earliest end is at or before its start, I reuse that room by popping; then I push its end. The heap's maximum size is the answer, in O(n log n).”

## Common mistakes when explaining Merge Intervals

- Forgetting to sort first.
- Saying O(n) when sorting dominates.

## Other problems

- [Easy · Hash map](https://app.mocklyenglish.com/mini-apps/explain-two-sum-in-english)

  [Two Sum](https://app.mocklyenglish.com/mini-apps/explain-two-sum-in-english)

  [Classic hash-map scan. Name brute force, then the map, walk \[2,7,11,15\] target 9, finish with O(n).](https://app.mocklyenglish.com/mini-apps/explain-two-sum-in-english)
- [Medium · Hash map](https://app.mocklyenglish.com/mini-apps/explain-group-anagrams-in-english)

  [Group Anagrams](https://app.mocklyenglish.com/mini-apps/explain-group-anagrams-in-english)

  [Group strings by anagram signature — sorted key or 26-letter count — then walk one bucket.](https://app.mocklyenglish.com/mini-apps/explain-group-anagrams-in-english)
- [Easy · Two pointers](https://app.mocklyenglish.com/mini-apps/explain-valid-palindrome-in-english)

  [Valid Palindrome](https://app.mocklyenglish.com/mini-apps/explain-valid-palindrome-in-english)

  [Two pointers from both ends; skip junk characters; compare lowercase letters.](https://app.mocklyenglish.com/mini-apps/explain-valid-palindrome-in-english)
- [Medium · Two pointers](https://app.mocklyenglish.com/mini-apps/explain-3sum-in-english)

  [3Sum](https://app.mocklyenglish.com/mini-apps/explain-3sum-in-english)

  [Sort, fix i, then two pointers for the pair that sums to −nums\[i\]. Deduplicate out loud.](https://app.mocklyenglish.com/mini-apps/explain-3sum-in-english)
- [Medium · Sliding window](https://app.mocklyenglish.com/mini-apps/explain-longest-substring-without-repeating-in-english)

  [Longest Substring Without Repeating Characters](https://app.mocklyenglish.com/mini-apps/explain-longest-substring-without-repeating-in-english)

  [Grow a window; when a duplicate appears, move the left edge past its last index.](https://app.mocklyenglish.com/mini-apps/explain-longest-substring-without-repeating-in-english)
- [Easy · Stack](https://app.mocklyenglish.com/mini-apps/explain-valid-parentheses-in-english)

  [Valid Parentheses](https://app.mocklyenglish.com/mini-apps/explain-valid-parentheses-in-english)

  [Stack story: push openers, pop on matching closer, empty stack at the end.](https://app.mocklyenglish.com/mini-apps/explain-valid-parentheses-in-english)

[Browse full catalogue](https://app.mocklyenglish.com/mini-apps/explain-leetcode-in-english)

FAQ

## Questions

### How do you explain Merge Intervals?

Sort by start, merge overlaps, O(n log n).

### Why do you sort by start in Merge Intervals?

After sorting by start, any interval that overlaps the merged range must come right after it, so a single left-to-right pass is enough.

### What is the time complexity of Merge Intervals?

O(n log n) because of the sort. The merging pass after sorting is O(n).

More questions? Email us at [contact@mocklyenglish.com](mailto:contact@mocklyenglish.com?subject=Mockly+support).

Course: [How to explain a LeetCode solution](https://app.mocklyenglish.com/guides/how-to-explain-leetcode-solutions) · [Think out loud](https://app.mocklyenglish.com/guides/how-to-explain-your-thoughts) · [Explain code out loud](https://app.mocklyenglish.com/blog/explain-code-out-loud-in-english)

## Related Mini Apps

- [Easy · Hash mapTwo SumClassic hash-map scan. Name brute force, then the map, walk [2,7,11,15] target 9, finish with O(n).](https://app.mocklyenglish.com/mini-apps/explain-two-sum-in-english.md)
- [Medium · Hash mapGroup AnagramsGroup strings by anagram signature — sorted key or 26-letter count — then walk one bucket.](https://app.mocklyenglish.com/mini-apps/explain-group-anagrams-in-english.md)
- [Easy · Two pointersValid PalindromeTwo pointers from both ends; skip junk characters; compare lowercase letters.](https://app.mocklyenglish.com/mini-apps/explain-valid-palindrome-in-english.md)

## Next steps

- Book a free 30-minute trial: https://app.mocklyenglish.com/book#coaches
- Try the free Mini Apps: https://app.mocklyenglish.com/mini-apps
- Prices: https://app.mocklyenglish.com/#pricing

## About Mockly English

Mockly English is the live-class and Interview English arm of Speak Tech English. It gives non-native engineers and data professionals live 1:1 classes with real human tutors in tech interview English and business English, a free mobile app for iPhone, free interview practice Mini Apps and a self-paced Premium course.

Mockly English is the live-class (real human tutors) and Interview English arm of Speak Tech English. Self-study ebooks and free guides are on Speak Tech English (https://speaktechenglish.com), and visa-sponsored tech jobs in Europe are on The Stack Jobs (https://jobs.trythestack.co), with a weekly newsletter at https://www.trythestack.co. All are products of Speak Tech Eng Ltd.

## Notes for agents

- Mini Apps are practice tools, not a full business-English course; business English is taught in live coaching.
- Only cite job offers that appear in published case studies.
- Agents can use Mockly's MCP server at https://app.mocklyenglish.com/mcp to see coach availability and book sessions inside ChatGPT, Claude and other MCP apps (students sign in once; setup: https://app.mocklyenglish.com/ai). There is no public REST product API.
- Cite as: "Free AI LeetCode Communication Coach — Merge Intervals, Mockly English (https://app.mocklyenglish.com/mini-apps/explain-merge-intervals-in-english)".
