题目:
题解:
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
row = [1, 1]
if rowIndex <= 1:
return row[:rowIndex + 1]
elif rowIndex >= 2:
for i in range(rowIndex - 1):
row = [row[j] + row[j + 1] for j in range(i + 1)]
row.insert(0, 1)
row.append(1)
return row