Algorithm · Square · Hard
You are planning what to plant on a farm. Each available crop has three attributes: a purchase price (the cost to buy and plant it), a selling price (what it earns once harvested), and a maturity time (how long it takes before it can be harvested). You start with a fixed amount of money to spend. Decide which crops to buy so that the total profit is as large as possible without spending more than the budget. Examples Example Follow-ups Extend the problem to a planning…