Robot fuel-constrained path
Your task
A delivery robot moves on a grid of characters: 'S' start, 'T' target, '.' open, '#' wall, 'F' fuel station. Each step into an open/target/fuel cell consumes 1 unit of fuel; the robot starts full with capacity units and cannot move with 0 fuel remaining. Stepping onto an 'F' cell refills fuel back to capacity (after paying the 1 unit to enter it). Return the minimum number of steps to reach 'T', or -1 if impossible. The grid has exactly one 'S' and one 'T'.
Examples
min_steps_with_fuel(grid: list[list[str]], capacity: int) -> intExample 1
Input
min_steps_with_fuel([["S", ".", ".", "T"]], 5)Output
3