If Anna goes from point A to point B, each step can only move up or move right. How many method(s) is / are there?(reference the grid below) If Anna goes from point A to point B, each step can only move up or move right. How many method(s) is / are there?(reference the grid below)

I’ve just recently learned permutations and combinations. Therefore, I understood how to answer problems regarding grids but only the type of questions with definite number of columns and rows. As shown in the picture above, the grids are different in size. I’m confused on how to solve this. I’d be happy if anyone could help.. Thank you.

This problem can be solved using dynamic programming, let's define the function $n(P_1, P_2) =$ number of ways to go from $P_1$ to $P_2$. Then we need to find $n(A,B)$, which can be computed by solving smaller subproblems (in bottom-up fashion, from left to right and from bottom to top) and combining the results of the subproblems, as shown in the below figure

