7
Back to Problem Dungeon

Parking Lot System

medium

Step 1: Requirements

Requirements

Questions to ask the interviewer

  1. How many floors and spots per floor?
  2. What vehicle types are supported — bike, car, truck?
  3. Is pricing time-based, flat, or tiered?
  4. Do we need real-time availability display at the entrance?
  5. Multiple entry/exit gates?
  6. Do we handle reservations or only walk-ins?
  7. Is there a monthly/subscription pass system?

Functional requirements

  • A parking lot has multiple floors, each with multiple spots of different sizes.
  • Vehicle types: Motorcycle, Car, Truck. Each needs a compatible spot size.
  • Assign the nearest available spot of the right size when a vehicle enters.
  • Track entry/exit time and calculate the fee based on a pricing strategy.
  • Display available spots per floor on entry panels.
  • Generate a parking ticket on entry; process payment on exit.

Non-functional requirements

  • Thread-safe spot assignment (no double-booking).
  • Extensible pricing (add new strategies without changing core logic).
  • Easy to add new vehicle types.

Assumptions

  • Single parking lot instance.
  • No advance reservations (walk-in only).
  • Payment is always successful (no payment gateway integration).

1 / 7 — Requirements