-
Notifications
You must be signed in to change notification settings - Fork 0
/
# Warehouse Picker
80 lines (63 loc) · 2.96 KB
/
# Warehouse Picker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Warehouse Picker
We need an application to handle the picking of items from a warehouse distribution centre.
Our warehouse has three rows of racking (racks 'a, 'b', and 'c') located around a central loading bay where the fork-lift trucks maneuver - no pedestrians allowed!
Each row of racking has ten bays (numbered 1 to 10). The racks are arranged in a "U" shape, with the warehouse-pickers' entrance to the warehouse by rack 'a', bay '10', and the exit by rack 'b', bay '10'.
Here's an ASCII-art illustration to help visualize (but you must've been to a Scandinavian furniture store... you know how it looks):
```
> c1 c2 c3 c4 c5 c6 c7 c8 c9 c10
>
> a1 __________________________ b1
> a2 | | b2
> a3 | | b3
> a4 | Loading bay... | b4
> a5 | | b5
> a6 | | b6
> a7 | Can't walk here. | b7
> a8 | | b8
> a9 | | b9
> a10 | | b10
>
> >> entrance >> exit
```
Our inventory is distributed amongst the bays, in no particular order.
Product | Bay
--------------|----
bath fizzers | b7
blouse | a3
bookmark | a7
candy wrapper | c8
chalk | c3
cookie jar | b10
deodorant | b9
drill press | c2
face wash | c6
glow stick | a9
hanger | a4
leg warmers | c10
model car | a8
nail filer | b5
needle | a1
paint brush | c7
photo album | b4
picture frame | b3
rubber band | a10
rubber duck | a5
rusty nail | c1
sharpie | b2
shoe lace | c9
shovel | a6
stop sign | a2
thermometer | c5
tire swing | b1
tissue box | b8
tooth paste | b6
word search | c4
Your job is to produce an app that does two things:
1) Given a list of bays, list the items in those bays, and calculate the distance from the two furthest apart bays. For instance:
- given "b5, b10, and b6", determine that the products are "nail filer, cookie jar, and tooth paste", and they're five bays apart
- given "b3, c7, c9 and a3", determine that the products are "picture frame, paint brush, shoe lace, and blouse", and they're 15 bays apart.)
2) Given a list of products, find the bays that need to be visited, and order them in the order they need to be visited from entrance to exit. For instance:
- given "shoe lace, rusty nail, leg warmers", determine that those items need to be collected from "c1, c9, and c10"
- given "hanger, deodorant, candy wrapper, rubber band", determine that those items need to be collected from "a10, a4, c8, and b9"
## Further considerations
Imagine that our warehouse had another rack built, opposite rack 'c', so now our warehouse forms a circular route. How would this impact the calculation of ordering the pick-list routes, and the distances between any two given bays? What amount of changes would you need to make to your solution to support this new requirement?