Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Calculated is better than guessed solution in Clear category for Can Balance by veky
from typing import Iterable
def can_balance(weights: Iterable) -> int:
torques = sum(i * weight for i, weight in enumerate(weights))
result, remainder = divmod(torques, sum(weights))
return -1 if remainder else result
Dec. 13, 2018
Comments: