Interesting. If I were in an interview, here’s exactly how I would approach it 👇🏻
> gathering requirements by asking
> example: number of floors, number of spots per floor
> vehicle types (two-wheeler, light, heavy, commercial)
> assign different parking spots based on vehicle type
> decide if parking spot status (free/occupied) should be visible to everyone
> ask if the system supports multiple simultaneous entries and exits (concurrency is a MUST)
Then move to entities👇🏻
- ParkingLot
- ParkingFloor
- ParkingSpot
- Ticket
- Vehicle (abstract base class)
- TwoWheeler, LightVehicle, HeavyVehicle, CommercialVehicle (derived ones)
- ChargesStrategy (abstract base class)
- FixedCharge, HourlyCharge (derived ones)
- FindingSpotStrategy (abstract base class)
- NearestSpot, FarthestSpot, BestSpot (derived ones)
Ok need some technical advice-
Say you actually get a Parking Lot question in LLD round of interview, how will you attempt it? (say time limit is 45 minutes)
I am not able to a single sufficient answer for this -
My peers were rejected in this and
Interview experiences seems to pretentious saying “I managed to impress interviewer” , like wtf?
just tell what you said.
And the blogs and gpt seem too “bookish”
Thank you