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