Amazon Interview Question

Maze with DFS find time complexity