Parking Lot LLD
Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-05-24
Problem Statement
Design and implement a Parking Lot System that supports vehicle parking, slot management, payments, and real-time availability tracking. The system should efficiently allocate slots for different vehicle types, handle multiple entrances/exits, and ensure proper billing and notifications.
🔶 Functional Requirements
1.Parking Slot Management
•Support multiple types of vehicles: Car, Bike, Truck, Electric Vehicle.
•Maintain different slot types: Compact, Large, Handicapped, EV Charging.
•Keep track of slot availability in real-time.
2.Vehicle Entry & Exit
•Register vehicle entry → assign the nearest available slot.
•Record entry timestamp and slot number.
•On exit, calculate parking fee based on duration and vehicle type.
3.Parking Fee Calculation
•Fees based on vehicle type and parking duration.
•Support discounts or memberships (optional).
4.Ticket Management
•Generate tickets with vehicle, slot, entry time, and ticket ID.
•Update ticket status upon exit.
5.Administration & Monitoring
•Admin can view parking lot occupancy.
•Monitor total vehicles parked, empty slots, and revenue.
•Support dynamic addition/removal of slots.
6.Optional Features
•Online reservation of parking slots.
•Notifications for available slots (especially EV charging slots).
•Support multiple entrances/exits with concurrent access.
🔶 Non-Functional Requirements
•Concurrency: Multiple vehicles entering/exiting simultaneously should not cause inconsistencies.
•Performance: Assign slots and calculate fees in real-time.
•Scalability: Handle large parking lots with hundreds of slots.
•Extensibility: Easy to add new vehicle types or slot types.
•Reliability: Ensure no double booking of slots.
🔶 Constraints
•Each slot can hold only one vehicle at a time.
•Vehicles cannot occupy slots for which they are not compatible (e.g., truck in compact slot).
•Fee calculation must be accurate to the minute/hour as per policy.
🔶 Example Use Cases
1.Car enters the lot → system assigns nearest compact slot → generates ticket.
2.Car exits after 3 hours → system calculates fee → marks slot as available.
3.Admin views dashboard → sees 75% occupancy, 2 EV slots free.
4.Bike tries to park in compact slot → system rejects → suggests bike slot.
👉 In short:
Design a Parking Lot System that manages vehicle entry/exit, slot allocation, parking fees, and real-time availability for multiple vehicle types while ensuring concurrency, reliability, and extensibility.