- from typing import List
- def getRow(rowIndex: int) -> List[int]:
- ret = list()
- for i in range(rowIndex + 1):
- res = list()
- for j in range(0, i + 1):
- if j == 0 or j == i:
- res.append(1)
- else:
- res.append(ret[i - 1][j - 1] + ret[i - 1][j])
- ret.append(res)
- return res
- print(getRow(6))
|