FlashcardNot attempted
Approaching an LLD question
Recall it before you reveal
Walk through how you approach "design a parking lot" in an interview.
Space to reveal
Show answer & explanation
1. Clarify scope: vehicle types? multiple floors? pricing rules? payments? 2. Nouns → classes: ParkingLot, Level, Slot, Vehicle, Ticket; verbs → methods: park, exit, findSlot. 3. Responsibilities: each class owns its state (a Slot knows if it's free; the Lot allocates). 4. Extension points: pricing via a Strategy, slot/vehicle creation via a Factory, display boards via Observer. 5. Testability: inject the clock and dependencies; avoid hidden globals. 6. Edge cases: full lot, double parking, invalid exits, concurrency.