Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Can Balance by Tinus_Trotyl
from typing import Iterable
def can_balance(weights: Iterable) -> int:
for fulcrum in range(len(weights)):
balance = [weights[x] * (x - fulcrum) for x in range(len(weights))]
if sum(balance) == 0: return balance.index(0)
return -1
Feb. 15, 2019
Comments: