SevyDevy

Design a parking lot

FreeLow-level designEasy

  • Low level design
  • Object oriented design
  • Design patterns

Quick answer

This low-level design interview question asks you to design a parking lot. Aim for a design that is modelled as clear classes, interfaces and relationships that can handle new requirements without a rewrite. Interviewers want to see how you name responsibilities, keep classes small and reason about change.

The problem

Design the object model for a parking lot management system in a multi-level parking garage. A vehicle arrives at an entry gate, receives a ticket and is assigned a free spot that fits its size. When it leaves, the driver pays at an exit gate, the spot is freed and the ticket is closed.

What must a parking lot do?

  • Levels and spots: The lot has several levels, and each level has many numbered spots.
  • Spot sizes: Spots are small (motorcycles), compact (cars) or large (vans and trucks). Some compact spots also have an electric charger.
  • Vehicle types: Motorcycle, car, van and truck. A vehicle may park in a spot of its own size or larger; a truck needs a large spot.
  • Entry: At an entry gate, find a suitable free spot, hold it and issue a ticket with a ticket ID, the vehicle's plate number, the spot and the entry time. Refuse entry when no suitable spot is free.
  • Exit and payment: At an exit gate, look up the ticket, compute the fee from the parked duration and the pricing rule, take payment by cash or card, free the spot and close the ticket.
  • Availability display: Show the number of free spots of each size on every level and at the entrance.
  • Lost ticket: Charge the daily maximum when a driver cannot show a ticket.

How well must it do it?

  • Correct under concurrency: 10 entry gates and 10 exit gates work at the same time. Two gates must never assign the same spot.
  • Fast assignment: Finding a spot must not scan every spot in the lot (up to 5 levels × 500 spots = 2,500 spots).
  • Extensible: Adding a vehicle type, a spot type or a pricing rule (hourly, weekend flat rate, charging surcharge) should not require editing existing classes.
  • Testable: Time and payment must be replaceable in tests so fee calculation can be unit tested.

Key concepts

  • Low level design
  • Object oriented design
  • Design patterns
  • Strategy pattern
  • Concurrency

How you’ll practise

6 short steps · save and come back any time
  1. Requirements
  2. Core objects
  3. Class relationships
  4. Key flows
  5. Extensibility
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any low-level design round.

  • Lists the use cases before writing classes
  • Gives each class one clear responsibility
  • Uses interfaces where behaviour is likely to change
  • Applies a design pattern only when it solves a real problem
  • Handles edge cases and invalid states explicitly
  • Walks through one use case end to end with the model

Questions people ask about this interview question

Which design type is this question?
It is a low-level design question. You design a parking lot and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Easy, so it suits engineers who are new to low-level design interviews. It is also a good warm-up before harder questions.
What should I cover first?
Start with the use cases and the core entities, then the responsibilities of each one. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
Yes. It is one of the free questions. Sign up to practise it step by step. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Free questionGuided steps, hints, AI review