Subset sum problem: Difference between revisions

Content deleted Content added
+ Haskell entry
Line 380: Line 380:
solver it = [comb | n <- [1 .. length it],
solver it = [comb | n <- [1 .. length it],
comb <- combinations n it,
comb <- combinations n it,
foldr (\a acc -> weight a + acc) 0 comb == 0]
sum (map weight comb) == 0]


items = [W "alliance" (-624), W "archbishop" (-915),
items = [W "alliance" (-624), W "archbishop" (-915),