I am given a grid or n * n. I need to find how many routes I can take to get from grid[0][0] to grid[n - 1][n - 1]. However in the grid there will be the letter 'H' in some of the spaces. If there is an "H", I cannot cross that place. I can only go to the right of down. I need to use the top-down approach and the bottom-up approach but I don't know how to do that. Here is an example:
grid = [['.', '.', '.', '.'],
['.', '.', '.', 'H'],
['.', '.', 'H', '.'],
['.', '.', '.', '.']]
I need to go from the first element to the last element without going through the 'H's. The answer to this example is 4.