Skip to content

Instantly share code, notes, and snippets.

@qqibrow
Created August 10, 2013 23:21
Show Gist options
  • Save qqibrow/6202617 to your computer and use it in GitHub Desktop.
Save qqibrow/6202617 to your computer and use it in GitHub Desktop.
class Solution {
public:
int uniquePaths(int m, int n) {
if( 0 == m || 0 == n)
return 0;
int path[m][n];
for (int i = 0; i < m; ++i)
for ( int j = 0; j < n; ++j) {
if( 0 == i || 0 == j)
path[i][j] = 1;
else
path[i][j] = path[i-1][j] + path[i][j-1];
}
return path[m-1][n-1];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment