from typing import List


class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        if numRows == 1:
            return [[1]]
        if numRows == 2:
            return [[1],[1,1]]
        result = [[1], [1,1]]
        for i in range(3, numRows+1):
            tmp = [0] * i
            tmp[0] = 1
            tmp[len(tmp)-1] = 1
            for j in range(1, len(tmp)-1):
                prev = result[i-2]
                tmp[j] = prev[j-1] + prev[j]
            result.append(tmp)
        return result

print(Solution().generate(numRows=5))
print("-"*60)
print(Solution().generate(numRows=1))
print("-"*60)
print(Solution().generate(numRows=10))
print("-"*60)
