You are viewing a single comment's thread. Return to all comments →
from heapq import heappush, heappop, heapify def cookies(k, A): heapify(A) i = 0 while A[0] < k and len(A) > 1: heappush(A, heappop(A) + (heappop(A) * 2)) i += 1 return i if A[0] >= k else -1
Seems like cookies are disabled on this browser, please enable them to open this website
Jesse and Cookies
You are viewing a single comment's thread. Return to all comments →