Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 676 Bytes

Budget_Cuts.md

File metadata and controls

5 lines (3 loc) · 676 Bytes

#Award Budget Cuts

The awards committee had planned to give n research grants this year, out of a its total yearly budget. However, the budget was reduced to b dollars. The committee members has decided to affect the minimal number of highest grants, by applying a maximum cap c on all grants: every grant that was planned to be higher than c will now be c dollars. Help the committee to choose the right value of c that would make the total sum of grants equal to the new budget.

Given an array of grants g and a new budget b, explain and code an efficient method to find the cap c. Assume that each grant is unique. Analyze the time and space complexity of your solution.