Honey Heist

From programming_contest
Jump to navigation Jump to search

This problem asks us the number of steps taken to reach a given node on a hexagonal grid.

It is trivially a BFS, but the challenge is that the grid is hexagonal. Fortunately, given that each edge only has max 20 nodes, we can write some code up front to calculate which cells border which others. Then once we have a graph, it's literally a BFS and check the distance to the destination cell