Pikachu has to carry a glowing lantern through a tiled maze. Walls are blocked; find the fewest orthogonal moves from S to T, or report that the lantern cannot reach it. Input: rows cols, followed by rows strings of #, ., S, T. Output: shortest move count, or -1.
Example 1:
Example 2:
Example 3:
Constraints:
1≤rows,cols≤1000; exactly one S and T.
Tags:
