Maximum Median
MediumRating 1400CodeforcesBinary Search on Answer
Approach hintTry it first, then revealHide
Sort the array; for the median to reach m, every element from the middle onward must be at least m. Binary search the largest m whose total cost is at most k.