We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5621fc5 commit d4ad759Copy full SHA for d4ad759
exercises/practice/knapsack/.meta/example.nim
@@ -1,7 +1,7 @@
1
type Item = tuple[weight: int, value: int]
2
3
proc maximumValue*(maximumWeight: int, items: openArray[Item]): int =
4
- var dp = new_seq[int](maximumWeight + 1)
+ var dp = newSeq[int](maximumWeight + 1)
5
for item in items:
6
for weight in countdown(maximumWeight, item.weight):
7
dp[weight] = max(dp[weight], item.value + dp[weight - item.weight])
0 commit comments