Question bank › Intervals
Dsa Intervals Easy

Cloud Shadow Density

Meteorologists are measuring 'double-cover' zones. Given N cloud intervals [start, end] on a 1D axis, calculate the total length of the axis that is covered by at least two clouds simultaneously. Input Format: - Line 1: N (number of clouds). - Next N lines: start and end of each cloud. Output Format: - A single integer representing the total length covered by >= 2 clouds. Example: Input: 3 1 10 2 5 6 9 Output: 6 (Explanation: Overlap between [1,10] and [2,5] is [2,5] (len 3). Overlap between [1,10] and [6,9] is [6,9] (len 3). Total 6.)

Key concepts

sweep lineinterval overlap

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.