```
def find_paths(m, n, _n, i, j)
return 1 if i == -1 or i == m or j == -1 or j == n
return 0 if _n == 0
return find_paths(m,n,_n-1,i-1,j) + find_paths(m,n,_n-1,i+1,j) + find_paths(m,n,_n-1,i,j-1) + find_paths(m,n,_n-1,i,j+1)
end
```

Not sure why it gives time limit exceeded though. Unable to understand why this is worse performing than the DP solution.