IPO: Maximize Capital
Hard · Heap & Priority Queue · about 25 minutes
Asked at Amazon, Google, Stripe, Visa, Ramp, Rippling, Brex, Mercury.
Your capital starts at w. There are projects to choose from: project i can be started only when your capital is at least capital[i], and finishing it adds profits[i] to your capital. You may finish at most k different projects, one after another. What is the largest capital you can end up with?