给定非负索引k(其中k≤33),返回Pascal三角形的第k个索引行。 行索引从0开始
Input: 3
Output: [1, 3, 3, 1]
思路都写在上一个文章118啦
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
l=[1]
for _ in range(rowIndex):
l=[sum(i) for i in zip([0]+l,l+[0])]
return l[:]