Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Design Parking Lot Classes

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Design Parking Lot Classes. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Implement a basic object-oriented parking lot system. Design Python classes to support parking and unparking vehicles, tracking available spots by vehicle type, and issuing a ticket when a vehicle is parked. The function should process a list of operations and return the outputs of query operations.

Constraints

  • 1 <= levels <= 20
  • 0 <= spots_per_level[type] <= 100 for each of bike, car, truck
  • 1 <= len(operations) <= 10^4
  • Vehicle numbers are unique among currently parked vehicles
  • Operations are one of park, unpark, or available

Function Signature

def process_parking_lot(levels, spots_per_level, operations):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output