Parking Lot
A multi-floor lot that allocates spots by vehicle type and charges on exit.
Medium45 minStrategySpot allocationConcurrency
Design a parking lot with multiple floors, different spot sizes, entry and exit gates, and hourly pricing. It's the most-asked LLD problem, so interviewers expect clean allocation logic, pluggable pricing, and a real answer about two cars racing for the last spot.
Requirements
Functional
- Multiple floors, each with spots of size SMALL, COMPACT, LARGE (plus optional EV and HANDICAPPED).
- Vehicle types: BIKE, CAR, TRUCK (plus EV variants); each fits certain spot sizes.
- Entry gate: allocate a suitable spot and issue a ticket; reject if full.
- Exit gate: compute fee from duration and vehicle type, accept payment, free the spot.
- Display board shows free spots per floor and type.
- Admin can add/remove floors and spots, mark spots out of service.
Non-functional
- Multiple gates operate concurrently; a spot is never double-allocated.
- Allocation should be fast: O(1) or O(log n), not a full scan.
- Pricing and allocation rules change often; they must be pluggable.
Try it first
Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.
45:00
Defend it out loud
The AI interviewer will probe your design for Parking Lot and score it.