8000 Merge pull request #443 from jojoo15/patch-37 · lee4code/leetcode-master@d6770c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6770c0

Browse files
Merge pull request youngyangyang04#443 from jojoo15/patch-37
优化 0062不同路径 python3版本
2 parents 5efc824 + a921b3b commit d6770c0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

problems/0062.不同路径.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,7 @@ Python:
279279
```python
280280
class Solution: # 动态规划
281281
def uniquePaths(self, m: int, n: int) -> int:
282-
dp = [[0 for i in range(n)] for j in range(m)]
283-
for i in range(m): dp[i][0] = 1
284-
for j in range(n): dp[0][j] = 1
282+
dp = [[1 for i in range(n)] for j in range(m)]
285283
for i in range(1, m):
286284
for j in range(1, n):
287285
dp[i][j] = dp[i][j - 1] + dp[i - 1][j]

0 commit comments

Comments
 (0)
0