链接 118. Pascal’s Triangle 题目Given an integer numRows, return the first numRows of Pascal’s triangle. 题解某种意义上算一个最开始的 DP ?我猜( 123456789101112class Solution: def generate(self, numRows: int) -> list[list[int]]: result = [[1], [1, 1]] if numRows < 3: return result[:numRows] for i in range(2, numRows): result.append( [1] + [result[i - 1][j] + result[i - 1][j + 1] for j in range(i - 1)] + [1] ) return result 2023