Maximize Seller Capital by Funding at Most K Growth Projects
Last updated: November 29, 2026
Quick Overview
You start with capital w and may complete at most k projects. Project i requires capital[i] to start and adds profit[i] to your capital when done. Choose projects to maximize final capital.
Amazon
November 29, 20260
0
0 solved
You start with capital w and may complete at most k projects. Project i requires capital[i] to start and adds profit[i] to your capital when done. Choose projects to maximize final capital.
A Hard greedy-plus-heap problem in Amazon's onsite style, framed as choosing which seller-growth investments to fund in order. Interviewers expect the two-structure approach: sort by required capital and use a max-heap of affordable profits, with a crisp argument for why greedy is optimal.
What the Interviewer Expects
- Sort projects by capital requirement
- Push profits of newly affordable projects into a max-heap
- Take the largest profit each round and update capital
- Stop early when nothing is affordable
- Argue greedy optimality: profits are non-negative and capital only grows
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- What if profits could be negative?
- What if each project took time and you had a deadline?
- How would you handle k much larger than the number of projects?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: integers k and w, lists profits and capital of equal length n. Profits are non-negative. Output: final capital after completing at most k distinct projects one after another....
High-Level Design
Sort projects by required capital. Keep a pointer into the sorted list. Each round, advance the pointer pushing profits of every project with capital requirement <= w into a max-heap. If the heap is e...