```
public int uniquePaths(int m, int n) {
int[][] map = new int[m][n];
return uniquePaths(m - 1,n - 1, map);
}
public int uniquePaths(int m, int n, int[][] map) {
if (m == 0 || n == 0) return 1;
if (map[m][n] == 0) map[m][n] = uniquePaths(m -1, n, map) + uniquePaths(m, n - 1, map);
return map[m][n];
}
```