Problem 1391 · Medium

Check if There is a Valid Path in a Grid

Each street type opens onto specific sides; search from the top-left cell through cells whose open sides connect back.

Open the interactive visualisation