首页 > 其他 > 详细

LeetCode.62-unique-paths

时间:2019-10-30 14:41:07      阅读:73      评论:0      收藏:0      [点我收藏+]

LeetCode.62-unique-paths

思路:https://segmentfault.com/a/1190000016315625

class Solution {
    public int uniquePaths(int m, int n) {
        
        int[][] paths = new int[m][n];
        for(int i=0;i<m;i++){
            for(int j=0;j<n;j++){
                if(i==0||j==0){
                    paths[i][j] = 1;
                }else{
                    paths[i][j] = paths[i-1][j]+paths[i][j-1]
                }             
            }      
        }
        return paths[m-1][n-1]
    }
}

 

LeetCode.62-unique-paths

原文:https://www.cnblogs.com/Jomini/p/11764168.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!