Split Array Largest Sum
Given an integer array nums and an integer m, split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m subarrays.

30:00

Split Array Largest Sum
hard
Topics
Companies

Given an integer array nums and an integer m, split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m subarrays.

Example 1:
Input: {"nums":[7,2,5,10,8],"k":2}
Output: 18
Constraints:
  • 1nums.length10001 \leq \text{nums.length} \leq 1000

  • 0nums[i]1060 \leq \text{nums}[i] \leq 10^6

  • 1kmin(50,nums.length)1 \leq k \leq \min(50, \text{nums.length})

Input
arr ={"nums":[7,2,5,10,8],"k":2}

Start. Search range [max(nums), sum(nums)]

7

2

5

10

8

Low
10
Mid (k)

-

High
32

Result: 32

Variables
No variables to display
DepthFunction Call
Stack empty
0/11