Google Interview Question

You should prepare DFS and trees very well