TLE error rat in maze

Just 1 test case not passing it shows TLE
can’t figure out please help

Limit the number of recursive calls by checking the down movement only when right movement fails.