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