Question bank › Intervals
Dsa Intervals Easy

Crane Safety Gap

A safety inspector needs to perform a check for a continuous duration 'D'. There are N active crane operations with intervals [start, end]. The inspector must work during a time where NO cranes are active. Find the earliest possible start time for the inspector within the range [0, MaxTime]. If no such window exists, return -1. Example: Input: N=2, D=15, MaxTime=100 Cranes: [10, 20], [30, 40] Available gaps: [0, 10], [20, 30], [40, 100] Earliest start for D=15 is 40.

Key concepts

intervalsmerginggap finding

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.