Practice · 4 of 5
Maximum Segment Sum Limit
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Split an array of n non-negative values into k
consecutive segments so that the **largest segment sum** is as small as
possible. Print that sum.
**Input:** Line 1: n k (1 <= k <= n <= 10^5). Line 2: n values
(0 <= a_i <= 10^4).
**Output:** One integer — the minimal possible maximum segment sum.
**Example:** 5 2 / 1 2 3 4 5 -> 9 (segments [1 2 3] and [4 5]).
Press Submit to check your solution.
Back to lesson: Practice: Search Set