A frog is travelling from point A $(0,0)$ to point B $(5,6)$ but each step can only be $1$ or $2$ units up or right. Compute the number of ways the frog can move from A to B.
I have solved a question on $1$D DP where we can define $f(i)$ to be the number of paths from $0$ to $i$th path then from recurrence/DP we have
$$f(i) = f(i-1)+f(i-2)$$ where we will go one step back or two steps back. Then for no of steps we need to add two options. How do we modify it by adding these condition?
Will this be a generalization $$f(i,j) = f(i-1,j)+f(i-2,j)+f(i,j-1)+f(i,j-2)$$? where, $f(i-1,j),f(i-2,j)$ will be one and two steps back to the left and $f(i,j-1),f(i,j-2)$ will be one and two steps back to the bottom.
This is a math question. I would be very happy if you can explain me without code as well, using a tree and a recurrence relation. For simplicity, you can also reduce the dimension from $(5,6)$ to any smaller number.