Every path into a cell enters it from above or from the left, so the number of paths to a cell is the sum of those two counts. Fill the grid row by row and the bottom-right corner holds the number of paths; a wall holds 0 and passes nothing on.
Every path into a cell enters it from above or from the left, so the number of paths to a cell is the sum of those two counts. Fill the grid row by row and the bottom-right corner holds the number of paths; a wall holds 0 and passes nothing on.