Here I introduce -D grid DP. Google and Amazon ask it frequently. Here's the pattern: for grid problems, define dp[i][j] as the answer for the subproblem ending at (i, j). Combine results from cells you can come from. Related problems: Minimum Path Sum (sum instead of count), Unique Paths II (with obstacles), Dungeon Game (tricky ordering).
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/dynamic-programming/unique-paths-why-this-problem
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████████████████████████████████████████████████████████████████████████████████████