Question bank › Intervals
Dsa Intervals Easy

Max Covered Time

You have a list of time intervals during which different events occur. Your task is to calculate the maximum time that is covered by at least one event. Each event is given as a start and end time. Your function should return the total covered time. For example, given the input '3 1 3 2 5 6 8', it means there are 3 events. Input: N start1 end1 start2 end2 ... Output: Total covered time as an integer. Example: Input: 3 1 3 2 5 6 8 Output: 6

Key concepts

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