Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Speedy DP solution in Speedy category for Loading Cargo by gyahun_dash
def checkio(data): #dynamic programming
sumdata = sum(data)
halfsum = sumdata // 2
outputs = {0}
for n in data:
diff = halfsum - n
outputs |= {m + n for m in outputs if m <= diff}
return sumdata - 2 * max(outputs)
June 1, 2014
Comments: