Grid Signals
Asked at Google
Reported by the problem's creator, not verified
A grid is a list of strings of equal length. S is a signal source, T is a target that must receive a signal, B is a blocker, and . is an empty cell. All sources start emitting at time 0, and each time unit a signal moves from a cell to each of its four neighbours. Signals pass through empty cells, sources and targets, and never enter a blocker. A target receives the signal at a time equal to its distance to the nearest source.
Examples
Example 1
Input: grid =
["S..T","...."]Output:
[3]Explanation: The signal needs 3 steps to travel from the
Scell to the target across the top row, so the answer is [3].
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.