For example, if the grid is 3 by 7, we need move to the right 6 times, and move down 2 times. In other words, we have 8 operations, and 2 of them are going down, the rest of them are going right. The result should be choose n-1 from m+n-2

```
class Solution {
public:
int choose(double a, double b){
double ans = 1;
while(b){
ans *= a-- / b--;
}
return ans + 0.5;
}
int uniquePaths(int m, int n) {
return choose(m+n-2,n-1);
}
};
```