Skip to content

Commit eded73c

Browse files
Update knapsack.py
1 parent 72b3adf commit eded73c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

knapsack/knapsack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def knapsack_recur(capacity: int, counter: int) -> int:
5454
else:
5555
left_capacity = capacity - weights[counter - 1]
5656
new_value_included = values[counter - 1] + knapsack_recur(
57-
left_capacity, not allow_repetition ? counter - 1 : counter
57+
left_capacity, counter - 1 if not allow_repetition else counter
5858
)
5959
without_new_value = knapsack_recur(capacity, counter - 1)
6060
return max(new_value_included, without_new_value)

0 commit comments

Comments
 (0)