Maximize funds with capital-gated projects
AppleSoftware Engineer · Technical ScreenLast updated
Maximize funds with capital-gated projects evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
You start with initial funds W and may undertake at most K projects. Each project i has a required capital C[i] and yields profit P[i]; you can only start project i if your current funds are at least C[i], and upon completion your funds increase by P[i]. Choose up to K projects to maximize your final funds. Design an efficient algorithm, specify the data structures, analyze time and space complexity, and justify correctness. Discuss how your solution scales when N is as large as 2e5.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.