Problem 934 · Medium

Shortest Bridge

Flood one island with DFS, then grow it layer by layer with BFS until it touches the other.

Open the interactive visualisation