Saturday, April 28, 2018

System design interview questions: DESIGN A PARKING LOT

April 28, 2018

Introduction


It is time for me to watch a system design interview asked at Google, Facebook. Here is the video link. It is 29 minutes video, I finally found time to complete the video from 9:18 PM to 9:47 PM.

System Design

The lecture is very structured. Let me write down some notes.

 Abstract Vehicle
 - string licensePlate
 - enum color

Car implements vehicle, same applies to MotorCycle, Bus, Truck. The size of car is Small, Medium, Large, Extra Large.

class ParkingLot(zipCode: int)
- Spot: placeVehicle(vehicle vehicle)

class Spot(id: Long, size: enum)

4 stacks
  placeVehicle  + put in hashMap
   O(1)
  Spot: removeVehicle(vehicle:Vehicle)
     -> Lookup hashMap





No comments:

Post a Comment