avp26/u11/knapsack.py
2026-12-01 20:17:15 +01:00

10 lines
218 B
Python

from functools import lru_cache
def maximum_value(maximum_weight, items):
for w in maximum_weight:
if maximum_weight < w:
continue
@lru_cache
def helper(i,w):
if i == len(items) or i == 0: