```
public class Solution {
public int uniquePaths(int m, int n) {
int max = m >= n ? m : n;
int min = m <= n ? m : n;
int up = m + n - 2;
int down = n - 1;
double solu = 1;
for(int i = up; i > m-1; i--){
if(down <= 1) down = 1;
solu *= (double) i / (double)(down--);
}
return (int) (solu + 0.5);
}
}
```