class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
ans = []
for i in range(rowIndex+1):
temp = [1]*(i+1)
ans.append(temp)
for j in range(1,i):
ans[i][j] = ans[i-1][j-1]+ans[i-1][j]
return ans[rowIndex]
119. 杨辉三角 II
最新推荐文章于 2024-05-25 22:08:00 发布