Skip to content

Commit 21e2c45

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 13d179b commit 21e2c45

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

matrix/pascal_triangle.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def generate_pascal_triangle(num_rows: int) -> list[list[int]]:
7474
triangle.append(current_row)
7575
return triangle
7676

77+
7778
def populate_current_row(triangle: list[list[int]], current_row_idx: int) -> list[int]:
7879
"""
7980
>>> triangle = [[1]]
@@ -112,10 +113,10 @@ def generate_pascal_triangle_optimized(num_rows: int) -> list[list[int]]:
112113
"""
113114
Returns a matrix representing Pascal's triangle.
114115
Reduces operations by half by eliminating redundant calculations.
115-
116+
116117
:param num_rows: Number of rows in the Pascal's triangle
117118
:return: 2D list representing the Pascal's triangle
118-
119+
119120
>>> generate_pascal_triangle_optimized(3)
120121
[[1], [1, 1], [1, 2, 1]]
121122
>>> generate_pascal_triangle_optimized(1)
@@ -158,11 +159,11 @@ def generate_pascal_triangle_optimized(num_rows: int) -> list[list[int]]:
158159
return result
159160

160161

161-
162162
def benchmark() -> None:
163163
"""
164164
Benchmark functions with different input sizes
165165
"""
166+
166167
def benchmark_a_function(func: Callable, value: int) -> None:
167168
call = f"{func.__name__}({value})"
168169
timing = timeit(f"__main__.{call}", setup="import __main__")

0 commit comments

Comments
 (0)