###118. Pascal's Triangle题目:<https://leetcode.com/problems/pascals-triangle/>难度:Easy高中数学知识,把行数理理清楚就ok```class Solution(object): def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ res = [[1],[1,1]] if numRows < 3: return res[:numRows] for i in range(3, numRows+1): tmp = [1] * i for j in range(1,i-1): tmp[j] = res[i-2][j-1] + res[i-2][j] res.append(tmp) return res```