Re: [閒聊] 每日LeetCode

作者: zoeredbird (柔依‧紅鳥)   2023-12-22 00:55:08
62.走路問題
原本打了快30行
瘋狂鬼打牆
排列組合沒學好的下場
class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
dp = [[0] * n for _ in range(m)]
for i in range(m):
dp[i][0] = 1
for j in range(n):
dp[0][j] = 1
for i in range(1, m):
for j in range(1, n):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[-1][-1]
作者: devilkool (對貓毛過敏的貓控)   2023-12-22 00:56:00
我的題目怎麼還沒更新
作者: oin1104 (是oin的說)   2023-12-22 01:08:00
這不是每日

Links booklink

Contact Us: admin [ a t ] ucptt.com