Unique Paths Problem Statement

Given the dimensions of an M x N matrix, determine the total number of unique paths from the top-left corner to the bottom-right corner of the matrix.

Allowed moves are only to the right or down at each step.

Input:

The first line contains an integer 'T', the number of test cases.
For each test case, a single line contains two space-separated integers 'M' and 'N', representing 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 the bottom-right cell of the matrix.
Print the output for each test case on a new line.

Example:

Input:
T = 2
M = 2, N = 2
M = 3, N = 3
Output:
2
6

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ M ≤ 15
  • 1 ≤ N ≤ 15
  • The time limit is 1 second

Note:

There is no need for you to print anything; simply implement the function to compute the results.
AnswerBot
8d

The problem involves finding the total number of unique paths from the top-left corner to the bottom-right corner of an M x N matrix with allowed moves only to the right or down.

  • Use dynamic programmin...read more

Help your peers!
Add answer anonymously...
Jio Platforms Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter