Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Brute force, itertools.product solution in Clear category for Loading Cargo by Rcp8jzd
from itertools import product
def checkio(data: list):
"""Brute force.
Computes the absolute weight difference between two arms for each weight
positioning.
"""
return min(abs(sum(item * arm for item, arm in zip(data, arm_side)))
for arm_side in product((-1, 1), repeat=len(data)))
May 31, 2020
Comments: