← BlackRock Interview Insights
Spent the first few minutes just laying out the class structure: Vehicle as a base with subtypes, ParkingSpot sized accordingly, ParkingLot holding multiple Levels.
Start by clarifying requirements and constraints, then design a clean class hierarchy with core entities like Vehicle, ParkingSpot, Level, and Ticket. Walk through key APIs for entry, exit, and spot finding, and discuss extensibility for reservations and real-time availability using appropriate data structures and design patterns.
Pro tip: Emphasize separation of concerns and extensibility: use interfaces and the Strategy pattern for fee calculation and spot allocation, and mention how you'd handle concurrency and persistence for real-time availability.
Ask about expected scale, vehicle types, spot sizes, pricing models, and whether reservations or real-time updates are needed. Confirm assumptions before diving into design.
Outline classes like Vehicle (with subclasses Motorcycle, Car, Truck), ParkingSpot (with size and type), Level, ParkingLot, Ticket, and Payment. Use inheritance and composition appropriately.
Specify methods for entry (issue ticket, assign spot), exit (calculate fee, free spot), and finding available spots (by type and level). Discuss data structures like maps or lists for efficient lookup.
Explain how fees are computed based on duration and vehicle type, possibly using a Strategy pattern. Mention integration with payment systems and ticket validation.
Describe how to extend for reservations (e.g., Reservation class, booking API) and real-time availability (e.g., observer pattern, caching, concurrency control). Highlight trade-offs in consistency, latency, and complexity.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.