Created
December 24, 2018 02:55
-
-
Save zhangxiaomu01/6e0c1569cf94ea74c6d934069eb36c44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
int uniquePaths(int m, int n) { | |
if (m > n) return uniquePaths(n, m); | |
vector<int> cur(m, 1); | |
for (int j = 1; j < n; j++) | |
for (int i = 1; i < m; i++) | |
cur[i] += cur[i - 1]; | |
return cur[m - 1]; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment