Back to problems

Shortest paths in a restaurant grid

Algorithm · Coinbase · Hard

A dining area is modeled as an $$m \times n$$ character grid. A server begins at one designated cell and moves through open floor while avoiding tables. The grid uses these symbols: S – the server's unique starting cell. . – an empty cell that can be entered. # – a blocked cell (table) that cannot be entered. F – a cell holding a food item. From any cell, the server may step to one of the four orthogonally adjacent cells. Each step into a cell that is not # costs 1.…

Checking your access…