Skip to content

Commit

Permalink
knapsack: fix indentation
Browse files Browse the repository at this point in the history
Co-authored-by: ee7 <[email protected]>
  • Loading branch information
siebenschlaefer and ee7 authored Feb 26, 2024
1 parent 529f48d commit ccb1cf9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exercises/practice/knapsack/.meta/example.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type Item = tuple[weight: int, value: int]

proc maximumValue*(maximumWeight: int, items: openArray[Item]): int =
var dp = newSeq[int](maximumWeight + 1)
var dp = newSeq[int](maximumWeight + 1)
for item in items:
for weight in countdown(maximumWeight, item.weight):
dp[weight] = max(dp[weight], item.value + dp[weight - item.weight])
Expand Down

0 comments on commit ccb1cf9

Please sign in to comment.