🔥🔥🔥 Heap + Greedy Solution (Beats 99.69%) 🔥Python 3🔥
\n# Code\n\nfrom heapq import heappush, heappop, nlargest\n\n\nclass Solution:\n    def findMaximizedCapital(self, k: int, w: int, profits: List[int], capital: 
\n# Code\n```\nfrom heapq import heappush, heappop, nlargest\n\n\nclass Solution:\n    def findMaximizedCapital(self, k: int, w: int, profits: List[int], capital: List[int]) -> int:\n        if w >= max(capital):\n            return w + sum(nlargest(k, profits))\n        \n        projects = [[capital[i],profits[i]] for i in range(len(profits))]\n        projects.sort(key=lambda x: x[0])\n        \n        heap = []\n        \n        for i in range(k):\n            while projects and projects[0][0] <= w:\n                heappush(heap, -1*projects.pop(0)[1])\n            \n            if not heap:\n                break\n            p = -heappop(heap)\n            w += p\n        return w\n```\n\n\n### If helpful, plz upvote :)
['Greedy', 'Heap (Priority Queue)', 'Python3']