Design a parking lot
Easy35 minFree, no account
The canonical warm-up. Easy to pass, easy to be unremarkable at.
The question
Design the software for a multi-storey car park: a vehicle arrives, is assigned a spot, parks, and pays on exit.
Spots come in sizes, vehicles come in sizes, and pricing differs by vehicle type and duration.
Functional
- Assign a spot to an arriving vehicle, or refuse entry when full.
- Issue a ticket; compute a fee on exit.
- Show free spots per floor and per size.
- Support several pricing schemes without changing the parking logic.
Non-functional
- Several entrances issuing tickets at once: two vehicles must never get the same spot.
- Spot lookup must not scan every spot in a 2,000-space car park.
35:00Commit to an answer before you open the solution. Reading it first teaches you to recognise good answers, which is not the skill being tested.
Stuck?
0 of 3 hints takenThe worked solution
written by a person · not a gradeScore yourself
0 of 5 marked- A clean entity model with no invented classes20
- Interfaces given as signatures, not prose15
- Stated the one-vehicle-per-spot invariant and made assignment atomic30
- Lookup better than a scan15
- Justified each pattern in one sentence; used none gratuitously20
We run no AI here and nothing on this page grades you. The score is yours, and the useful number is the one you get on the same problem a month from now, cold.
kept in this browser only