leetcode Unique Paths
来源:互联网 发布:电池校准软件 编辑:程序博客网 时间:2024/05/17 05:17
题目链接
思路:
这个题目就是求c(m+n-2,n-1)。。也是组合数学里面非降路径的概念
import java.math.BigInteger;public class Solution { public int uniquePaths(int m, int n) { BigInteger result=new BigInteger("0"); BigInteger up=new BigInteger("1"); BigInteger down=new BigInteger("1"); for(int i=m;i<m+n-1;i++) { up=up.multiply(new BigInteger(Integer.toString(i))); } for(int i=1;i<=n-1;i++) { down=down.multiply(new BigInteger(Integer.toString(i))); } result=up.divide(down); return Integer.valueOf(result.toString()); }}
0 0
- leetcode Unique Paths && Unique Paths
- Leetcode-Unique Paths&Unique PathsII
- [LeetCode] Unique Paths and Unique Paths II
- leetcode--Unique Paths && Unique Paths ii
- leetcode--Unique Paths && Unique Paths ii
- 【Leetcode】【python】Unique Paths/Unique Paths II
- LeetCode: Unique Paths
- LeetCode: Unique Paths II
- [Leetcode] Unique Paths
- [Leetcode] Unique Paths II
- LeetCode : Unique Paths
- LeetCode : Unique Paths II
- leetcode 9: Unique Paths
- [LeetCode] Unique Paths
- [LeetCode] Unique Paths II
- [LeetCode]Unique Paths
- [LeetCode]Unique Paths II
- [LeetCode] Unique Paths
- 151017总结
- javaMail发送邮件激活注册用户
- Android提示框Dialog
- Android ViewPager屏蔽预加载
- 分割 回文字符串
- leetcode Unique Paths
- 怎么解决每次打开Office 2013都提示配置进度
- Android的使用介绍
- FastJson使用
- Android SQLite 的学习
- 第三届IT禅修营善行实践指导小组讨论
- STL库中 队列的应用
- Spark primer 之 统计csdn十大常用密码
- HDU 3999----The order of a Tree(二叉树的前序遍历)