Given a list of stock amounts and their profits and an initial budget to buy stocks, maximize total profit (solvable with a priority queue).
Asked in the Round 2 - DSA / Problem Solving stage. Candidate realized only afterward that a priority queue was the intended optimal approach; the interviewer was described as non-interactive, making the problem statement hard to clarify.
Implement maximize_profit(k, initial_budget, capital, profits). Each project requires the corresponding capital[i], returns profits[i], and can be selected at most once. Return the final budget after selecting at most k affordable projects. A project is affordable when its capital requirement is at most the current budget, and its profit is added immediately.
def maximize_profit(k, initial_budget, capital, profits):