public class Solution {
    /**
     * 
     * @param m int整型 
     * @param n int整型 
     * @return int整型
     */
    public int uniquePaths (int m, int n) {
        // write code here
        if(m == 1 || n ==1 ){
            return 1;
        }
        return uniquePaths(m-1,n)+uniquePaths(m,n-1);
    }
}

递归

列出初始条件 f(m,1),f(1,n)=1;

f(m,n)=f(m-1,n)+f(m,n-1);