Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle.
In Pascal's triangle, each number is the sum of the two numbers directly above it as shown:
之前就寫過PasCal's Triangle了
從row開始依序向下計算,
最左、最右直接append(1)
中段就由上一row的加起來
class Solution:
    def getRow(self, numRows: int) -> List[List[int]]:
        triangle = [[1]]
        ans = []
        for i in range(1,numRows+1):
            for j in range(i+1):
                if j == 0 or j==i:
                    ans.append(1)
                else:
                    ans.append(triangle[i-1][j-1] + triangle[i-1][j])
            triangle.append(ans)
            ans = []
        return triangle[numRows]
