Given a non-negative?index?kwhere?k?≤?33, return the?kthindex row of the Pascal's triangle.
Note that the row index starts from?0.
class Solution(object):
? ? def getRow(self, rowIndex):
? ? ? ? """
? ? ? ? :type rowIndex: int
? ? ? ? :rtype: List[int]
? ? ? ? """
? ? ? ? row = [1]
? ? ? ? for index in range(1, rowIndex+1):
? ? ? ? ? ? row = [1]+[row[x]+row[x-1] for x in range(1, index)] + [1]
? ? ? ? return row
1 list可以用[]相互加起來