https://www.geeksforgeeks.org/count-possible-paths-top-left-bottom-right-nxm-matrix/
The problem is to count all the possible paths from top left to bottom right of a mXn matrix with the constraints that from each cell you can either move only to right or down
Examples :
Input : m = 2, n = 2; Output : 2 There are two paths (0, 0) -> (0, 1) -> (1, 1) (0, 0) -> (1, 0) -> (1, 1)
Note the count can also be calculated using the formula (m-1 + n-1)!/(m-1)!(n-1)!.
Another Approach:(Using combinatorics) In this approach We have to calculate m+n-2 C n-1 here which will be (m+n-2)! / (n-1)! (m-1)!
Another Approach:(Using combinatorics) In this approach We have to calculate m+n-2 C n-1 here which will be (m+n-2)! / (n-1)! (m-1)!