```
class Solution {
public:
int uniquePaths(int m, int n) {
double s=1,s1=1;
if(m==1||n==1) return 1;
int max=(m>n)?(m-1):(n-1);
int min=(m<n)?(m-1):(n-1);
for(int i=max+1;i<=max+min;i++) {s*=i;s1*=i-max;}
return s/s1;
}
};
```