Easy python with explanation
Intuition
first sort based on capital (tagging profit) , as we need to choose min capital
at every iteration we need to choose max profit for the respective 'w'
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

- first sort based on capital (tagging profit) , as we need to choose min capital 
- at every iteration we need to choose max profit for the respective 'w'
- so use max heap to obtain max profit


# Complexity
- Time complexity:O(n*log(n))
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```



class Solution:
    def findMaximizedCapital(self, k: int, w: int, profits: List[int], capital: List[int]) -> int:
        
        arr=[(c,p) for c,p in zip(capital ,profits)]
        arr.sort() #  sort arr based on capital

        maxprof=[]
        heapify(maxprof)
        cnt,i=0,0

        while cnt<k: # worst case runs k times
            while i<len(profits) and arr[i][0] <=w: # if ith capital <=w then push to heap
                heappush(maxprof,-arr[i][1]) # maxheap
                i+=1
            
            if maxprof: # from capital take max capital
                temp=(-heappop(maxprof))
                w+=temp
                
                cnt+= 1 
            else:  # if heap is empty , in next iteration also we can't extract anything which satisfies ith capital <=w 
                return w
        
        return w






```
['Python3']