Amazon VO Interview Question: Suggestion of Locker Sizes (Locker Sizing / Box Fitting)

17 Views
No Comments

An Amazon pickup location has a set number of lockers in which boxes are dropped off and picked up.

Boxes can come in many different sizes. Lockers come in a few pre-defined different sizes, with different heights, widths and lengths like these:

Suggestion of locker sizes:
S: 2,2,2 (width, height, length)
M: 4,4,4
L: 8,8,8

Model the lockers, boxes and pickup location and implement:

  • An algorithm for efficiently finding the best possible empty locker for a given box (i.e. the smallest empty locker that can fit the box).
  • Methods to store a box in a locker within a pickup location
  • Methods to retrieve a box from a locker within a pickup location

This problem asks you to design a locker management system for an Amazon pickup location. The key challenge is to efficiently choose the smallest available locker that can fit a box, then support storing and retrieving boxes. A good solution usually groups lockers by size and uses an ordered structure or priority queues to find the best-fit locker quickly, while keeping a mapping from boxes to lockers for fast retrieval.

END
 0