Paths Around the Walls
Count the right/down paths from the top-left to the bottom-right of a grid, avoiding wall cells (#), modulo 109+7.
Input: the first line has N and M; the next N lines each have M characters (. free, # wall).
Output: the number of paths mod 109+7.
Constraints:
- 1 ≤ N, M ≤ 1000
Sample Tests
Input 1
3 3 ... .#. ...
Output 1
2
Input 2
1 1 .
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.