While looking at job announcements on LinkedIn, I found one particularly interesting
opening for an Algorithmic Trader. As part of the interview process I've been invited
to take part in a programming exam. I found one of the three problems quite entertaining.
Below I've rephrased the problem a bit so as to avoid the solutions be simply searchable
on the internet:
"Ms. Pac-Man has been placed onto the top level of cubic 3D labyrinth. The labyrinth consists
of \(h\) levels divided into \(m\) by \(n\) areas each. Some areas have columns that support
ceiling, some areas are free. Ms. Pac-Man can move only to free areas laterally or between
the levels. Every move takes Ms. Pac-Man \(5\) seconds. The pair of cherries is waiting for
Ms. Pac-Man at the lowest level. Write a program that helps Ms. Pac-Man to find the cherries
as fast as possible by finding the shortest path between them and outputting time this path
takes. The structure of the labyrinth is given bellow.
Ms. Pac-Man's location is marked with '\(1\)', the cherries’ location is marked with '\(2\)'.
'\(.\)' - marks a free spot and '\(o\)' marks a column."