Skip to content

Commit cfc9916

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 227bc29 commit cfc9916

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

data_structures/arrays/pascals_triangle.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
In Pascal's triangle, each number is the sum of the two numbers directly above it.
1111
"""
1212

13+
1314
class Solution:
1415
def generate(self, num_rows: int) -> list[list[int]]:
1516
"""
@@ -36,10 +37,12 @@ def generate(self, num_rows: int) -> list[list[int]]:
3637
row = [1] * (i + 1)
3738
# Compute inner elements by summing elements from the previous row
3839
for j in range(1, i):
39-
row[j] = ans[i-1][j-1] + ans[i-1][j]
40+
row[j] = ans[i - 1][j - 1] + ans[i - 1][j]
4041
ans.append(row)
4142
return ans
4243

44+
4345
if __name__ == "__main__":
4446
import doctest
47+
4548
doctest.testmod()

0 commit comments

Comments
 (0)