Shortest Travel Time in a Grid with Traffic Lights

You are given an m × n 2D grid representing a road network. Each cell is one of:

  • 0: free road, can be passed freely;
  • 1: obstacle, cannot be passed;
  • 2: traffic light, the car can only ente...

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: