class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
res = []
for i in range(numRows):
temp = [0] * (i+1)
for j in range(i + 1):
if j == 0 or j == i:
temp[j] = 1
else:
temp[j] = res[i-1][j] + res[i-1][j-1]
res.append(temp)
return res