#!/usr/bin/env python3

__author__ = 'Wei Mu'

class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        
        if numRows == 0:
            return []
        
        ans = [None] * numRows
        ans[0] = [1]
        
        for i in range(1, numRows):
            ans[i] = [None] * (i+1)
            ans[i][0] = ans[i-1][0]
            ans[i][-1] = ans[i-1][-1]
            
            for j in range(1, len(ans[i])-1):
                ans[i][j] = ans[i-1][j-1] + ans[i-1][j]
        
        return ans
