Equal Experts Interview Question: How would you create a parkin... | Glassdoor.co.in

Interview Question

Software Engineer Interview Pune

How would you create a parking system where you need to

  allot a space when a car enters and free it up when it leaves. When car leaves no interaction is required between car and parking alloter/guard.

Interview Answer

2 Answers


I started with hashmap for keeping id of parking space and parking space alloted or not. But with this approach you need car to interact with guard when leaving the space, which was later told. Then I suggested few more data structure as per my understanding then I finally reached on array structure where index could be id and parking object presence or absence will tell parking space is allocated or not. Parking object would be storing car name, or some other details if reqd, some primary key would be stored. But I guess they were not satisfied with my answer.

Interview Candidate on 08-Mar-2015

If what i understand ,the problem says i don't have to look for empty spaces. For that to happen i only have information of empty spaces with me that i can allot[will associate space with car] and when car leaves the space comes back to me. so i don't have to look for if empty space are available.

Anonymous on 16-Aug-2018

Add Answers or Comments

To comment on this, Sign In or Sign Up.