Question bank › Intervals
Dsa Intervals Warm-up

Range Queries with Overlap

You are given a list of ranges and a list of queries. Your task is to determine how many of the ranges overlap with each query. Each range and query is represented by a start and end time. Input begins with an integer n for the ranges followed by n lines of ranges, followed by an integer m for queries and m lines of queries. Output a list of integers where each integer represents the count of overlapping ranges for each query. Example: Input: 3 09:00 10:00 09:30 11:00 10:00 12:00 2 09:00 09:30 10:15 11:30 Output: 2 1

Key concepts

intervalsqueriesoverlap

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.