Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Design Parking Lot Classes

MediumPython00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the Python screen.

The question is on your right: Design Parking Lot Classes. Read through the requirements first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

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