class Solution:
def generate(self, numRows: int) -> List[List[int]]:
result = []
if numRows == 0:
return []
i = 0
j = 0
while(i < numRows):
temp_result = []
while(j < i + 1):
if j == 0 or j == i:
temp_result.append(1)
else:
temp_result.append(result[i-1][j-1] + result[i-1][j])#找规律就行
j += 1
result.append(temp_result)
i += 1
j = 0
return result
来源:CSDN
作者:JustForYouForDL
链接:https://blog.csdn.net/JustForYouForDL/article/details/103656611