Q.5. Given 2 integers n and m. Consider a Matrix A with n rows and m columns.
You start from A[0][0]. From the current position, you can only go towards the
right or down direction. (i.e. from A[i][j], you can go to A[i+1][j] or A[i][j+1] ). Given
2 indices, x and y, find out the number of ways to reach A[x][y] from A[0]
[0].Input: n=4, m=5, x=2, y=3
Answers
Answered by
0
Answer:
Here is ur answer dear. I don't know whether it's correct or not sorry dear.
Step-by-step explanation:
Input : m = 2, n = 2;
Output : 2
There are two paths
(0, 0) -> (0, 1) -> (1, 1)
(0, 0) -> (1, 0) -> (1, 1)
Input : m = 2, n = 3;
Output : 3
There are three paths
(0, 0) -> (0, 1) -> (0, 2) -> (1, 2)
(0, 0) -> (0, 1) -> (1, 1) -> (1, 2)
(0, 0) -> (1, 0) -> (1, 1) -> (1, 2)
All the best dear
Similar questions