Unique Paths

Try to solve the Unique Paths problem.

Statement

Imagine a scenario where an adventurous little robot, named Robi, has a mission to traverse a grid with m rows and n columns and reach a treasure box placed at grid[m−1][n−1]grid[m-1][n-1]. Robi starts the journey from its home in the top-left corner of the grid, grid[0][0]grid[0][0]. However, it faces a constraint that at any given time, it can only move in either of the two directions: downward or to the right.

Given the two integers, m and n, return the total number of unique paths that Robi can take from the grid's top-left corner to reach the bottom-right corner of the grid.

Constraints:

  • 1 ≤\leq m, n ≤\leq 100

Example

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.