Safest Path for a Mouse in a Grid

Given an N × N grid:

  • S: mouse start,
  • T: cheese target,
  • C: cat location,
  • #: impassable water,
  • .: passable land.

The mouse may move up, down, left, or right on land cells only. T...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: