less than 1 minute read

Given a list of non-negative integers nums and an integer k, you can split the list into k non-empty sublists.

Return the minimum largest sum of the k sublists.

Constraints

  • k ≤ n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/Split-List-to-Minimize-Largest-Sum

Examples

Example 1

Input

  • nums = [1, 3, 2, 4, 9]
  • k = 2

Output

  • answer = 10

Explanation

We can split the list into these 2 sublists: [1, 3, 2, 4] and [9].

Solution

Leave a comment