Optimal Commute

Problem: Optimal Commute

You are given a 2D city grid containing:

  • .: an empty passable cell, which can also be chosen as the home / starting location;
  • #: an obstacle that cannot be passed...

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: