【leetcode】62. Unique Paths【java】
来源:互联网 发布:爱仕达陶瓷不粘锅知乎 编辑:程序博客网 时间:2024/06/06 05:41
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible unique paths are there?
Above is a 3 x 7 grid. How many possible unique paths are there?
Note: m and n will be at most 100.
public class Solution { public int uniquePaths(int m, int n) { if (m <= 0 || n <= 0){ return 0; } int[][] dp = new int[m][n]; for (int i = 0; i < n; i++){ dp[0][i] = 1; } for (int j = 0; j < m; j++){ dp[j][0] = 1; } for (int i = 1; i < m; i++){ for (int j = 1; j < n; j++){ dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; } } return dp[m - 1][n - 1]; }}
0 0
- (Java)LeetCode-62. Unique Paths
- 【leetcode】62. Unique Paths【java】
- [leetcode]62. Unique Paths(Java)
- [Leetcode] Unique Paths (Java)
- [LeetCode][Java] Unique Paths
- Leetcode 62. Unique Paths (Medium) (java)
- [LeetCode]62.Unique Paths
- LeetCode --- 62. Unique Paths
- LeetCode 62.Unique Paths
- [Leetcode] 62. Unique Paths
- [leetcode] 62.Unique Paths
- [leetcode] 62.Unique Paths
- leetcode 62. Unique Paths
- Leetcode 62. Unique Paths
- [leetcode] 62. Unique Paths
- 62. Unique Paths LeetCode
- [LeetCode]62. Unique Paths
- 【LeetCOde】62. Unique Paths
- JavaScript面向对象(2)-一些属性、方法、运算符
- spring IOC容器实例化Bean的方式与RequestContextListener应用
- android布局属性详解
- ROS进二阶学习笔记(5)- 命名与命名空间
- javascript 对象原型,原型链,属性枚举
- 【leetcode】62. Unique Paths【java】
- 一个C++小题目引出的问题
- volatile简介
- Spring4.06+mybatis3.2.5整合activiti5.17.0
- freemarker页面如何获取绝对路径basePath
- Jax-ws 开发webService ,并使用spring注入service类中遇到 空指针
- 微信公众号开发--接收与回复消息(Java)
- Gradle编译时,assets文件未打包进apk
- Asponse.Cell的API调用