leetcode62.[DP] Unique Paths
来源:互联网 发布:微信淘宝客封号 编辑:程序博客网 时间:2024/06/03 01:26
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?
当
TLE代码
class Solution(object): def uniquePaths(self, m, n): if m==1 or n==1: return 1 else: return self.uniquePaths(m-1,n)+self.uniquePaths(m,n-1)
Accept代码
class Solution(object): def uniquePaths(self, m, n): num=[] print num for i in range(m): num.append([]) for j in range(n): if i==0 or j==0: num[i].append(1) else: num[i].append(num[i][j-1]+num[i-1][j]) return num[m-1][n-1]
0 0
- leetcode62.[DP] Unique Paths
- LeetCode62:Unique Paths
- Leetcode62 Unique Paths
- leetcode62-Unique Paths
- Leetcode62: Unique Paths
- LeetCode62. Unique Paths
- leetcode62. Unique Paths
- leetcode62. Unique Paths
- leetcode62. Unique Paths
- Leetcode62-63 Unique Paths
- LeetCode62——Unique Paths
- 【LeetCode62 Unique Paths】动态规划计算路径
- 【DP】Unique Paths
- 【DP】Unique Paths II
- 【Leetcode】Unique Paths (DP)
- Unique Paths II (DP)
- Unique Paths II DP
- DP Unique Paths
- 二叉树的前序、中序、后序遍历
- zigbee协议解析:地址分配机制
- 并查集模板
- Python基础--人们一些最爱的标准库(random time)
- 屏幕适配问题1
- leetcode62.[DP] Unique Paths
- Mybatis junit测试时报: parameter *** not found.available 错误处理
- weblogic安装与配置
- TabControl控件和TabPage
- C# 选择文件 和 选择文件夹 对话框
- 屏幕适配问题2
- 《Objective-C 2.0程序设计》第2章练习
- hdu1205吃糖果(鸽巢原理)
- Android加载网页输入框无法弹出输入法