Grid path from start to target, then the path farthest from a cat

0
Remix

An N x N grid has a start cell S, a target cell T, water cells and land cells. You move one step up, down, left or right and can never enter water.

  1. Decide whether you can get from S to T.
  2. Now a mouse starts at S, the cheese is at T, and a cat sits still at cell C. The safety of a path is the smallest distance between the cat and any cell on the path. Find the path from S to T whose safety is as large as possible and return that safety.
GoogleCodingLast asked Sep 2026
No answer yet. Write the first one; the best answer gets endorsed.