Total Unique Paths Problem Statement
You are located at point ‘A’, the top-left corner of an M x N matrix, and your target is point ‘B’, the bottom-right corner of the same matrix. Your task is to calculate the total number of unique paths from ‘A’ to ‘B’. Given the dimensions of the matrix as integers ‘M’ and ‘N’, find the total number of unique paths from MATRIX[0][0] to MATRIX[‘M’-1][‘N’-1].
Traversal Method:
Within the matrix, each move can be either Right or Down. For instance, if currently at MATRIX[i][j], you can proceed to MATRIX[i+1][j] or MATRIX[i][j+1].
Input:
The first line of input entails an integer 'T', the count of test cases. Each test case consists of a single line encompassing two space-separated integers ‘M’ and ‘N’, specifying the number of rows and columns of the matrix, respectively.
Output:
For each test case, output a single integer representing the total number of unique paths from the top-left to bottom-right cell of the matrix. Each test case output is printed on a separate line.
Example:
Input:
2
3 3
2 2
Output:
6
2
Constraints:
- 1 ≤ T ≤ 100
- 1 ≤ M ≤ 15
- 1 ≤ N ≤ 15
Note:
No need to print anything; just implement the function to return the correct answer.
Be the first one to answer
Add answer anonymously...
Top Atlassian Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Top HR questions asked in Atlassian Software Developer Intern
>
Atlassian Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app