master-algorithms-py/math/pascal_triangle.py
2023-07-31 12:46:59 -07:00

14 lines
283 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def get_row(self, irow: int) -> list[int]:
if irow == 0:
return [1]
result = self.get_row(irow - 1)
return [1] + [sum(_) for _ in zip(result, result[1:])] + [1]