You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
7
+
8
+
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
9
+
10
+
How many possible unique paths are there?
11
+
12
+
Example 1:
13
+
14
+
Input: m = 3, n = 2
15
+
Output: 3
16
+
Explanation:
17
+
From the top-left corner, there are a total of 3 ways to reach the bottom-right corner:
18
+
1. Right -> Right -> Down
19
+
2. Right -> Down -> Right
20
+
3. Down -> Right -> Right
21
+
Example 2:
22
+
23
+
Input: m = 7, n = 3
24
+
Output: 28
25
+
26
+
*/
27
+
28
+
// Solution 1
29
+
// This solution is a naive solution implementing a binary tree and visiting each node.
0 commit comments