Your question is Resource Allocation Dynamic Programming. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
PhonePe wants to distribute a fixed promotional budget across merchants. For each merchant, several campaign options are available, where each option has a spending cost and an expected business value. Select at most one option per merchant and maximize the total expected value without exceeding the budget.
Implement allocate_campaign_budget(budget, merchant_options), where budget is an integer and merchant_options[i] is a list of [cost, value] pairs for merchant i. The function must return the maximum total value achievable. A merchant may receive no campaign, and unused budget is allowed.
def allocate_campaign_budget(budget, merchant_options):