Question bank › Intervals
Dsa Intervals Easy

The Redacted Project Timeline

An engineer has a list of active project periods [start, end]. However, the company went through a 'blackout' period [B_start, B_end] where all work is considered void. Find the total number of valid work hours. Valid hours are hours spent in project periods that do not overlap with the blackout period. Input Format: - Line 1: N (number of project periods). - Next N lines: start and end of each period. - Last line: B_start and B_end of the blackout. Output Format: - Total valid work hours (integer). Example: Input: 2 10 20 25 35 15 30 Output: 10 (Explanation: Project 1 [10,20] minus blackout [15,30] = [10,15] (len 5). Project 2 [25,35] minus blackout [15,30] = [30,35] (len 5). Total 10.)

Key concepts

interval merginginterval subtraction

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.