Baseline Binary Search · In Search Space O(n log S), where S is the total sum · O(1)
An ordered write log must be cut into at most k shards, each shard processed by one worker whose latency tracks the shard's total load. Cuts respect log order, and the slowest worker determines the pipeline's latency. Split the log so the heaviest shard is as light as possible and report that load.
Input: An array nums of n non-negative integers and an integer k, the maximum number of shards.
Output: The minimized largest shard sum over all valid splits into at most k non-empty contiguous shards.
1 <= nums.length <= 10000 <= nums[i] <= 10^61 <= k <= min(50, nums.length)Input: {"nums":[7,2,5,10,8],"k":2}
Output: 18
Cutting after the third entry balances 14 against 18, and no single cut keeps both shards at or below anything smaller.
Input: {"nums":[1,2,3,4,5],"k":2}
Output: 9
The split 1+2+3 against 4+5 caps the heavier shard at 9.