Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
brute force solution in Clear category for Loading Cargo by flpo
from itertools import chain, combinations
def checkio(w):
if len(w) == 1:
return w[0]
subsets = chain.from_iterable(combinations(w, n) for n in range(1, len(w)))
return int(2*min(abs(sum(w)/2 - sum(s)) for s in subsets))
Jan. 2, 2018
Comments: