public class Solution {

```
public int uniquePaths(int m, int n) {
if(m==1||n==1) return 1;
int max = m>n?m:n;
int min = m<n?m:n;
long a = 1;
long b = 1;
for(int i=1;i<min;i++){
a *= i;
b *= (max+i-1);
}
return (int)(b/a);
}
```

}