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.
Calculate total unique paths from top-left to bottom-right corner of a matrix by moving only right or down.
Use dynamic programming to solve the problem efficiently.
Create a 2D array to store the numbe...read more
Top Amazon Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Top HR questions asked in Amazon Software Developer Intern
Reviews
Interviews
Salaries
Users/Month