Skip to main content

Practice · 2 of 3

The Monotone Feasibility

CHALLENGE
Difficulty: advanced+25 XP

**Scenario.** Split an array into the fewest contiguous parts so each part's sum is ≤ S. Checking a fixed part-count bound greedily is easy. The intended acceleration? **Which approach is the best fit? The program only needs to print the letter.** **A)** Binary search on the answer (the maximum part sum) with a greedy feasibility check **B)** DP over all part boundaries **C)** Sort the array and greedily group **D)** Bellman–Ford on a part-graph

Back to lesson: Practice: Optimization Drills