You have k projects available. Each project has profit[i] and capital[i] requirement. Starting with capital w, select at most k projects (sequentially) to maximize final capital.
Greedy Two-Phase
Sort projects by capital; at each round, pick the highest-profit affordable project.