版权声明:本文为博主原创文章,请尊重原创,转载请注明原文地址和作者信息! https://blog.csdn.net/zzc15806/article/details/81297442
class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
temp = [0, 1]
for i in range(rowIndex+1):
row = []
for j in range(len(temp)-1):
row.append(temp[j]+temp[j+1])
temp[:] = row[:]
temp.insert(0,0)
temp.append(0)
return row
class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
row = [1]
for _ in range(rowIndex):
row = [x + y for x, y in zip([0]+row, row+[0])]
return row