Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Obvious solution in Clear category for The Final Stone by veky
def final_stone(S: list[int]) -> int:
from heapq import heapify as heap, heappop as pop, heappush as push
heap(S := [-s for s in S])
while len(S) >= 2: push(S, pop(S) - pop(S))
return len(S) and -S[0]
July 22, 2022
Comments: