Skip to content

Commit f587515

Browse files
committed
Time: 0 ms (100.00%) | Memory: 6.9 MB (19.85%) - LeetSync
1 parent 7f5f0b7 commit f587515

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

62-unique-paths/unique-paths.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
int uniquePaths(int m, int n) {
4+
vector<vector<int>> dp(m, vector<int>(n, 1));
5+
for (int i = 1; i < m; i++) {
6+
for (int j = 1; j < n; j++) {
7+
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
8+
}
9+
}
10+
return dp[m - 1][n - 1];
11+
}
12+
};

0 commit comments

Comments
 (0)