← Questions

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

0
GoogleCodingLast asked Sep 2026

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.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding