Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Final Stone by tokiojapan55
def final_stone(stones: list[int]) -> int:
while len(stones) > 1:
stones = sorted(stones)
s1 = stones.pop(-1)
s2 = stones.pop(-1)
if s1 != s2:
stones.append(abs(s1 - s2))
return sum(stones)
Aug. 31, 2022
Comments: