Amazon interview question

Asked me to code DFS