8 lines
277 B
Python
8 lines
277 B
Python
class Solution:
|
|
def generate(self, numRows: int) -> List[List[int]]:
|
|
rows = []
|
|
for i in range(1, numRows + 1):
|
|
row = [1 if j == 0 or j >= i - 1 else rows[i-2][j-1]+rows[i-2][j] for j in range(i)]
|
|
rows.append(row)
|
|
return rows
|