Google Interview Question

DFS based question with performance improvement.

Interview Answer

Anonymous

Oct 29, 2021

I solved the question along with performance improvement. The reason for reject was missing boundary conditions.