Question bank › Greedy
Dsa Greedy Easy

Parking Lot Optimization

You are managing a parking lot that has several defined parking slots. Each slot can hold one vehicle for a certain time interval defined by its start and end times. Given a list of parking intervals, determine the maximum number of vehicles that can be parked at the same time, without overlapping of their time slots. Input format: - The first line contains an integer k (1 ≤ k ≤ 100) - the number of parking intervals. - The next k lines each contain two integers, start and end (0 ≤ start < end ≤ 24) representing the start and end times of each parking slot. Output format: - A single integer representing the maximum number of vehicles that can be parked simultaneously. Example: Input: 3 1 3 2 5 4 6 Output: 2

Key concepts

greedyintervalssorting

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.