Skip to content

Commit daef077

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

knapsack/knapsack.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def recur(cap: int, idx: int) -> int:
6363
return recur(capacity, n_items)
6464

6565

66-
def _knapsack_dp(capacity: int, weights: list[int], values: list[int], allow_repetition: bool) -> int:
66+
def _knapsack_dp(
67+
capacity: int, weights: list[int], values: list[int], allow_repetition: bool
68+
) -> int:
6769
"""Iterative dynamic programming version of the knapsack problem."""
6870
n = len(weights)
6971
dp = [0] * (capacity + 1)
@@ -85,4 +87,5 @@ def _knapsack_dp(capacity: int, weights: list[int], values: list[int], allow_rep
8587

8688
if __name__ == "__main__":
8789
import doctest
90+
8891
doctest.testmod()

0 commit comments

Comments
 (0)