The spider and the fly
A rectangular room is 30 feet long, 12 feet wide and 12 feet high. A spider sits on the middle line of one end wall, 1 foot below the ceiling. A fly sits on the middle line of the opposite end wall, 1 foot above the floor, and does not move.
The spider must crawl along the walls, ceiling or floor (no jumping, no webs).
What is the length of the shortest route? The straightforward route, up 1 foot to the ceiling, 30 feet along the ceiling, and 11 feet down the far wall, is 42 feet. Beat it.
Show a hint
Unfold the room into a flat net of rectangles and draw straight lines. There are several ways to unfold; the best route crosses five of the six faces.
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.