Pregunta de entrevista de IBM

Hackerrank Maze Question with follow ups.