Quantcast interview question

Write DFS