← Back to all problems
Medium

Merge Intervals

Updated Feb 24, 2026

Problem

Merge all overlapping intervals.

Constraints

1 <= intervals.length <= 10^4

Examples

Example 1

Input: {"intervals": [[1, 3], [2, 6], [8, 10], [15, 18]]}
Output: [[1, 6], [8, 10], [15, 18]]

Function Signature

def merge(self, intervals: list[list[int]]) -> list[list[int]]

How to Submit

Implement a Solution class with a merge method.

Your method will be called with the input parameters and should return the answer.