Question bank › Intervals
Dsa Intervals Easy

Count Unique Ages in Intervals

You have a list of age ranges represented as 'X-Y', where X and Y are integers. Your task is to count the unique ages that fall within these ranges and print the count. Input: - A single line of space-separated age ranges. Output: - A single integer representing the count of unique ages. Example: Input: 10-15 12-18 14-20 Output: 11

Key concepts

intervalscounting

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.