Amazon | SDE - 3 Interview Question
Anonymous User
3368

Amazon Store operates dark stores which can be thought of as strategically located warehouses which service a geographical area around them.

Each warehouse has a racking facility which is designed in a layout like this

  17  16  15  14  13  
  18   5   4    3    12  
  19   6   1    2    11  
  20   7   8    9    10 
  21  22  23 24....

Where the numbers indicate the rack number. The facility can be theoretically very large and hence the representation might not fit in computer memory.

The entry and the pick up desk of the facility is located near rack 1, so the start and the end of the order packing needs to start from near rack 1. In order to pick up an item from its rack the pickup partner needs to navigate the facility in four possible directions - top, left, bottom and right along the racks. No other form of navigation is allowed.

It takes 1 unit duration to travel between neighbouring racks and it takes 1 unit duration to select and pick up an item. Given an order which looks like

Order #123
Item #1 - Rack 13
Item #2 - Rack 10
Item #3 - Rack 23

The total duration for preparing this order for delivery is the sum of the navigation and pick up duration of all items.

Write a program which outputs a navigation plan to the pickup partner such that the preparation time of the given order is minimized

Output: 1->8->23->24->25->10->11->12->13

Can anyone post solution / suggestion on how to solve this?

Comments (2)