1 class Solution: 2 def getRow(self, rowIndex: int) -> List[int]: 3 ans = [1] 4 for i in range(rowIndex): 5 # tmp = [1] 6 # for j in range(1,len(ans)): 7 # tmp.append(ans[j-1] + ans[j]) 8 # tmp.append(1) 9 # ans = tmp 10 j = len(ans)-1 11 while j > 0: 12 ans[j] += ans[j - 1] 13 j -= 1 14 ans.append(1) 15 return ans