Amazon interview question

one graph question ,one backtracking question