Split Array Largest Sum

Problem Description

Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized. Return the minimized largest sum of the split. This is the exact same pattern as the D.E. Shaw question: "Given an array of tasks and N servers, find the minimum total time to complete all tasks where tasks must be picked in sequence." Binary search on the answer: lo = max(nums), hi = sum(nums). Check feasibility: can we partition into ≤ k groups each with sum ≤ candidate? Example 1: Input: nums = [7,2,5,10,8], k = 2 Output: 18 Explanation: Split into [7,2,5] and [10,8] — max sum = 18. Example 2: Input: nums = [1,2,3,4,5], k = 2 Output: 9 Explanation: Split into [1,2,3] and [4,5].

Example Test Cases

Example 1
Input: [[7,2,5,10,8],2]
Expected: 18
Example 2
Input: [[1,2,3,4,5],2]
Expected: 9
Example 3
Input: [[1,4,4],3]
Expected: 4

Run your code to see the results