Question bank › Intervals
Dsa Intervals Easy

Dual Radio Coverage

N radio transmitters cover segments on a 1D frequency axis. Each transmitter covers the interval [start, end). Due to interference, engineers are specifically interested in frequencies covered by EXACTLY two transmitters. Calculate the total length of the frequency axis that has a coverage count of exactly 2. Input Format: The first line contains N. The next N lines each contain two integers: start and end. Output Format: Print the total length covered by exactly 2 transmitters. Example: Input: 3 1 10 5 15 8 20 Output: 9 Explanation: - [1,5): 1 transmitter - [5,8): 2 transmitters (length 3) - [8,10): 3 transmitters - [10,15): 2 transmitters (length 5) - [15,20): 1 transmitter (length 5) Total length with 2: 3 + 5 = 8. Wait, check: [5,8) is 3, [10,15) is 5. Total 8.

Key concepts

intervalssweep-line

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.