Question bank › Greedy
Dsa Greedy Medium

Budget Allocation for Projects

A government wants to allocate its budget across various projects based on their urgency ratings. The urgency of a project determines how essential it is to fund it, while each project has a specific budget requirement. Your task is to allocate the total available budget to maximize the urgency covered. Input: The first line contains two integers: `B` (total budget) and `P` (number of projects). Each of the next `P` lines contains two integers: `U_i` (urgency rating) and `C_i` (cost of the project). Output: Print a single integer: total urgency rating covered by the funded projects. Example: Input: 100 4 10 50 20 30 15 20 25 60 Output: 45

Key concepts

greedysortingarray

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.