Question bank › Intervals
Dsa Intervals Warm-up

Overlapping Time Ranges

You are given a list of time ranges, and each range is represented by two integers [start, end]. Your task is to identify how many pairs of time ranges overlap with each other. A pair of ranges [a, b] and [c, d] overlap if max(a, c) < min(b, d). Input format: - The first line contains an integer n, the number of time ranges. - The next n lines each contain two integers, start and end of each range. Output format: - Print the number of overlapping pairs of ranges. Example: Input: 4 1 5 2 6 8 10 3 9 Output: 3

Key concepts

intervalsoverlapconflict

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.