Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Loading Cargo by UFO665
from itertools import combinations
def checkio(data):
totalSum = sum(data)
halfSum = totalSum / 2
result = halfSum
i = 1
while i < len(data):
for c in combinations(data, i):
tempResult = abs(sum(c) - halfSum)
if tempResult < result:
result = tempResult
if result == 0:
break
if result == 0:
break
i += 1
return result * 2 + totalSum % 2
Jan. 24, 2016