IBM Interview Question

Hackerrank Maze Question with follow ups.