Design Parking Lot
| Difficulty: Easy | Source: awesome-low-level-design |
Requirements
- Multiple levels, each with parking spots
- Different vehicle types: cars, motorcycles, trucks
- Each spot accommodates a specific vehicle type
- System assigns spot on entry, releases on exit
- Real-time tracking of spot availability
- Multiple entry/exit points with concurrent access
Class Diagram

Classes, Interfaces and Enumerations
| Class/Interface | Description |
|---|---|
| ParkingLot | Singleton; maintains list of levels, methods to park/unpark |
| ParkingFloor | A level with list of spots; handles parking within that level |
| ParkingSpot | Individual spot; tracks availability and current vehicle |
| Vehicle | Abstract base class; extended by Car, Motorcycle, Truck |
| VehicleSize | Enum for vehicle types |
Design Patterns Used
| Pattern | Application |
|---|---|
| Singleton | ParkingLot has a single instance managing the entire system |
| Factory (optional) | Create vehicles based on type without exposing instantiation logic |
| Observer (optional) | Notify displays or systems when spot availability changes |
Code Implementations
| Language | Source Code |
|---|---|
| Java | View on GitHub |
| Python | View on GitHub |
| C++ | View on GitHub |
| C# | View on GitHub |
| Go | View on GitHub |