class Solution:
def findMaximizedCapital(self, k: int, w: int, profits: List[int], capital: List[int]) -> int:
projects = deque(sorted(zip(capital, profits)))
max_heap = []
for _ in range(k):
while projects and projects[0][0] <= w:
heappush(max_heap, -projects.popleft()[1])
if max_heap:
w -= heappop(max_heap)
return w
O(N*logN + K*logN)
(정렬 + heap 추가, 삭제)O(N)