Google interview question

A recursive function + BFS