Distance to Nearest Destination on Grid (Including Obstacles)

Given an R x C 2D character grid board:

  • 'd' marks a destination (there may be multiple),
  • 'x' marks an obstacle cell,
  • any other character is a normal traversable cell.

Compute, for **ev...

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: