Python solution
Keep a max-heap of current possible profits. Insert possible profits as soon as their needed capital is reached.\n\n    def findMaximizedCapital(self, k, W, Pro
Keep a max-heap of current possible profits. Insert possible profits as soon as their needed capital is reached.\n\n    def findMaximizedCapital(self, k, W, Profits, Capital):\n        current = []\n        future = sorted(zip(Capital, Profits))[::-1]\n        for _ in range(k):\n            while future and future[-1][0] <= W:\n                heapq.heappush(current, -future.pop()[1])\n            if current:\n                W -= heapq.heappop(current)\n        return W
[]