shlogg · Early preview
Md Ariful Haque @mah-shamim

Maximizing Capital With Limited Projects And Initial Investment

Maximize capital by sorting projects by capital and using a max-heap to track profits, selecting k most profitable projects.

502. IPO
Difficulty: Hard
Topics: Array, Greedy, Sorting, Heap (Priority Queue)
Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. Since it has limited resources, it can only finish at most k distinct projects before the IPO. Help LeetCode design the best way to maximize its total capital after finishing at most k distinct projects.
You are given n projects where the ith project has a pure profit profits[i] and a minimum capital of capital[i] is needed to...