Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Can Balance by Oleg_Domokeev
from typing import Iterable
def can_balance(weights: Iterable) -> int:
for i in range(len(weights)):
if not sum((k - i) * weight for k, weight in enumerate(weights)):
return i
return -1
Dec. 14, 2018
Comments: