Google Interview Question

Tree traversal question, bfs/dfs question