':type rowIndex: int
:rtype: List[int]'

def getRow3(self, rowIndex):

    if (rowIndex == 0):
        return [1]
    res = [1, 1]
    def add(nums):
        res = nums[:1]
        for (i, j) in enumerate(nums):
            if (i < (len(nums) - 1)):
                res += [(nums[i] + nums[(i + 1)])]
        res += nums[:1]
        return res
    while (res[1] < rowIndex):
        res = add(res)
    return res
