Skip to content

Commit f66692c

Browse files
committed
comment on 62
1 parent da004e0 commit f66692c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dp/62.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
# Author: Yu Zhou
5+
# 62. Unique Path
6+
7+
# 解题思路:
8+
# 先解决横向竖向第一列,全部设成1,用了个小trick把所有的DP矩阵都设成了1
9+
# 状态:计算从前到现在节点为止所有的路劲
10+
# 状态转移方程:f[x][y] = f[x-1][y] + f[x][y-1]
11+
# 最后返回右下角的数就行。
12+
113
class Solution(object):
214
def uniquePaths(self, m, n):
315
"""
416
:type m: int
517
:type n: int
618
:rtype: int
719
"""
20+
821
#edge:
922
if not m or not n:
1023
return 0

0 commit comments

Comments
 (0)