You are given two integers m and n representing the number of rows and columns of a grid. A robot starts at the top-left cell (0, 0) and wants to reach the bottom-right cell (m-1, n-1).
The robot can only move:
Right (R)
Down (D)
Your task is to calculate the total number of unique paths the robot can take to reach the destination. Return the total number of possible paths.
Example 1
Input: m = 1, n = 1
Output: 1
Explanation: The robot is already at the destination.
Example 2
Input: m = 2, n = 2
Output: 2
Explanation: The robot can go Right?Down or Down?Right.
Example 3
Input: m = 3, n = 3
Output: 6
Explanation: Different combinations of right and down moves lead to 6 distinct paths.
Sign in to write, run, and submit your solution against the full test suite.