```
//AC - 0ms;
int uniquePaths(int m, int n)
{
if(m > n) return uniquePaths(n, m);
m--, n--;
long long denominator = 1;
long long member = 1;
while(m > 0)
{
member *= m + n;
denominator *= m;
m--;
}
return member / denominator;
}
```

```
//AC - 0ms;
int uniquePaths(int m, int n)
{
if(m > n) return uniquePaths(n, m);
int *arr = (int*)malloc(sizeof(int)*m);
for(int i = 0; i < m; i++)
arr[i] = 1;
for(int i = 1; i < n; i++)
for(int j = 1; j < m; j++)
arr[j] += arr[j-1];
return arr[m-1];
}
```