Unique Paths
Try to solve the Unique Paths problem.
We'll cover the following
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
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
m,n100
Example#
1 of 4
2 of 4
3 of 4
4 of 4
Understand the problem#
Let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Unique Paths
What will be the output if the following values of input are given?
= 2
= 2
1
2
3
4
Try it yourself#
Implement your solution in the following coding playground:
The optimal solution to this problem runs in O(m x n) time and takes O(m x n) space.
You might want to go over the Dynamic Programming pattern again.
Solution: Partition Equal Subset Sum
Solution: Unique Paths