You are viewing a single comment's thread. Return to all comments →
def minSum(num, k): num = sorted(num) queue = deque([]) queue.append(math.ceil(num.pop()/2)) for i in range(k-1): if len(num)==0: num=sorted(queue) queue=deque([]) temp = num[-1] if len(queue)>0 and queue[0]>temp: t = queue.popleft() queue.append(math.ceil(t/2)) else: num.pop() queue.append(math.ceil(temp/2)) return sum(queue)+sum(num)
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Sum 10
You are viewing a single comment's thread. Return to all comments →