You are viewing a single comment's thread. Return to all comments →
from collections import deque h1, h2, h3 = deque(h1), deque(h2), deque(h3) sum1, sum2, sum3 = sum(h1), sum(h2), sum(h3) while not (sum1 == sum2 == sum3): m = min(sum1, sum2, sum3) if sum1 > m: sum1 -= h1.popleft() elif sum2 > m: sum2 -= h2.popleft() elif sum3 > m: sum3 -= h3.popleft() return sum1
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →