Meta Interview Question

It was a BFS problem.