Shortest Path on a Grid with Gas Stations (State Reset)

You are given an m x n grid grid where:

  • S is the start
  • T is the target
  • # is a wall (blocked)
  • . is an empty cell
  • G is a gas station

You start at S. You may move one cell at ...

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: