Split into k pieces, minimise the largest
Write min_largest_sum(nums, k) that splits the non-negative list into k non-empty
consecutive pieces so that the largest piece sum is as small as possible, and returns
that sum.
min_largest_sum([7, 2, 5, 10, 8], 2) -> 18
min_largest_sum([1, 2, 3, 4, 5], 2) -> 9
min_largest_sum([1, 4, 4], 3) -> 4
Binary search on the answer: for a candidate maximum, greedily count how many pieces are
needed; if at most k, the candidate is achievable.
def min_largest_sum(nums, k):
...