- Denisse's Newsletter
- Posts
- Day 10 Pattern: Merge Intervals
Day 10 Pattern: Merge Intervals

Hello and welcome back brave human being,
All LeetCode problems are easy if you know the right pattern.
Today we are going to really understand how to do interval problems.
What is the problem asking for?
An interval problem can usually be identified when the input is an array of pairs.
This type of problem heavily relies on knowing how to sort the pairs, usually with a custom sort.
For this type of problem, I recommend you draw a line and identify how the intervals interact with one another.
Day 10: 56. Merge intervals
Given a set of time intervals in any order, merge all overlapping intervals into one.
Let's set an example…
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].
I’ll give you a hint on how to solve this problem 😉
Cheers to your success,
Denisse
Need motivation to be consistent?
Add this problem to your log and when the challenge is done send it to me! You’ll be in for a treat.
Reply