Amazon Interview Question

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-05-04Added By Anonymous
Source: Link

Company: Amazon
Role: unknown
Interview Stage: unknown
Location: unknown
Year: unknown

Original Post Content:

Implement two functions of a Valet parking in best time complexity.

assignSlot();
freeSlot();

Now there could be different sizes of slots which would cater different sizes of vehicles. If a vehicle can be parked in a M size slot, no need to park it in a L slot unless you don't have free M slots. You need to find the best slot in terms of best size fit as well as nearest to the valet location for the easy retrieval. It's upto you how do you want to show slot/vehicle size/dimension and how parking grid looks like.

What is the best way to solve this?

Comments