mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update pascal_triangle.py
This commit is contained in:
parent
9a820d8599
commit
3d8721aaeb
@ -3,11 +3,11 @@
|
|||||||
# author: bt3gl
|
# author: bt3gl
|
||||||
|
|
||||||
|
|
||||||
def get_row(self, irow: int) -> list[int]:
|
def get_row(self, row: int) -> list[int]:
|
||||||
|
|
||||||
if irow == 0:
|
if row == 0:
|
||||||
return [1]
|
return [1]
|
||||||
|
|
||||||
result = self.get_row(irow - 1)
|
result = self.get_row(row - 1)
|
||||||
|
|
||||||
return [1] + [sum(_) for _ in zip(result, result[1:])] + [1]
|
return [1] + [sum(_) for _ in zip(result, result[1:])] + [1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user