Algorithm · C3.ai · Medium
You are given a grid in which every cell is a wall, a gate, or an empty room. Fill in each empty room with the distance from that room to the closest gate. If a room has no path to any gate, leave it marked as unreachable. Examples Example