Pregunta de entrevista de Google

Algorithm problem about DFS and backtracking