Practice · 2 of 3
The Slowly Shrinking Answer
CHALLENGE
Difficulty: advanced+25 XP
**Scenario.** You can afford to pay c coins to increase a parameter x by 1, and the objective f(x) is provably non-increasing in x. The cost budget is huge (10^18). What is the intended family? **Which approach is the best fit? The program only needs to print the letter.** **A)** Simulate incrementing x one by one until the budget runs out **B)** Binary search the largest affordable x, since f is monotone **C)** DP over budget amounts **D)** Greedy: spend everything immediately
Press Submit to check your solution.
Back to lesson: Practice: Observation Drills