Question bank › Intervals
Dsa Intervals Easy

Merge Intervals

You are tasked with organizing a schedule based on a set of intervals. The goal is to merge all overlapping intervals into the least number of intervals possible. Print the merged intervals in the form (start, end). Input Format: - The first line contains an integer n (1 <= n <= 100) - the number of intervals. - The next n lines each contain two integers: the start and end of each interval. Output Format: - Print each merged interval in the format 'start end'. Example: Input: 4 1 3 2 6 8 10 15 18 Output: 1 6 8 10 15 18

Key concepts

intervalsmergingsorting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.