Skip to content

Instantly share code, notes, and snippets.

@fpdjsns
Created October 29, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpdjsns/7640cc2431977f51ce86007374ddf8e5 to your computer and use it in GitHub Desktop.
Save fpdjsns/7640cc2431977f51ce86007374ddf8e5 to your computer and use it in GitHub Desktop.
[leetcode] 62. Unique Paths : https://leetcode.com/problems/unique-paths/
class Solution {
public:
int uniquePaths(int m, int n) {
vector<int> arr(m+1,1);
arr[0] = 0;
for(int i=1;i<n;i++){
for(int j=1;j<=m;j++){
arr[j] += arr[j-1];
}
}
return arr[m];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment