```
class Solution {
public:
int uniquePaths(int m, int n) {
if(m <=0 || n <= 0) return 0;
long long res = 1;
for(int i = n; i < m+n-1 ; i++){
res = res * i / (i- n + 1);
}
return (int)res;
}
};
```

The total step number should be m+n-2. This means that we have to move down for m-1 steps and move right n-1 steps to reach the definition. Then different choice number would be:

UniqueStepNum = choose (m-1) from (m+n-2) = choose (n-1) from (m+n-2)

= (m+n-2)! / [(m-1)! * (n-1)!]

= ( (m+n-2) / (m-1) ) * ( (m+n-3) / (m-2) ) * ... * (n / 1)