A courier crosses a city grid given as a list of equal-length strings, where '.' is an open block and '#' is closed for roadworks. Starting at the top-left cell, the courier may only move right or down, and must reach the bottom-right cell. Write route_count(grid) returning the number of distinct routes. If the start or the destination is closed the answer is 0.
Examples
Input: grid = [".#.",
"...",
".#."]
Output: 1
Explanation: the only route goes down, down, right, right... no: down, right, right, down.
Input: grid = ["..",
".."]
Output: 2
Constraints
1 <= rows, cols <= 60- A memoised recursion needs at most
rows + colsstack levels.
Goals
- Express a grid path count in terms of two neighbouring cells
- Treat blocked cells and out-of-range cells as contributing zero
- Memoise on the cell coordinates