Question d'entretien d'embauche Equal Experts: How would you create a parkin... |

Question d'entretien d'embauche

Entretien de Software Engineer Pune (Inde)

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.

Réponse de l'entretien

2 réponses


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.

Candidat à l'entretien, le 8 mars 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.

Utilisateur anonyme, le 16 août 2018

Ajouter des réponses ou des commentaires

Pour commenter ceci, se connecter ou s'inscrire