Swiggy | Machine Coding Round | SDE 4 | Parking Lot System

Anonymous User
2968

I recently interviewed in Swiggy. The first round was Machine Coding round.
Time Limit: 2 hours

Problem Statement:
I own a multi-storey parking lot that can hold up to 'n' cars at any given point in time. Each slot is given an auto incrementing sequential number to uniquely identify itself. I want to create an automated ticketing system that allows my customers to use my parking lot without human intervention.

When a car enters my parking lot from any one of the multiple entry points, I want to have a ticket issued to the driver. The ticket issuing process includes us documenting the registration number (number plate) and the colour of the car and allocating an available parking slot to the car before actually handing over a ticket to the driver (we assume that our customers are nice enough to always park in the slots allocated to them). The customer should be allocated a parking slot which is nearest to the entry. At the exit the customer returns the ticket which then marks the slot they were using as being available.

Requirements:
Due to government regulation, the system should provide me with the ability to find out:
● Registration numbers of all cars of a particular colour.
● Slot number in which a car with a given registration number is parked.
● Slot numbers of all slots where a car of a particular colour is parked.

Parking lot landscape:

  1. Multi storey parking.(Multiple lanes in single floor)
  2. Vehicle categories(bike-4 per slot,car-2 slot,bus/truck-1 slot)
  3. Entrypoint are selected slots present in 4 corner slots

Assumptions: there is enough space to move vehicles between slots.

Expectations :
● We are really interested in your low level design, object oriented skills so please keep that in mind.
● Please follow coding conventions and directory structure in whichever language you use.
● Input to your system can be done using a file, sysin or through test cases whichever way you want to choose.
● Payment for parking based on time and category.(charges open to interpretation)
● A parking spot is supposed to be homogeneous - a single parking spot can have vehicle(s) of a single category. For ex: a spot can't have a bike and a car, either 1-4 bikes or 1-2 cars or 1 truck.

The full interview experience can be found here: Swiggy | SDE 4

Comments (2)