Split Array Largest Sum

Try to solve the Split Array Largest Sum problem.

Statement

Given an integer list nums and an integer k, split nums into k non-empty subarrays such that the largest sum among these subarrays is minimized. The task is to find the minimized largest sum by choosing the split such that the largest sum of every split of subarrays is the minimum among the sum of other splits.

Constraints:

  • 11\leq nums.length 103\leq 10^3

  • 00\leq nums[i] 104\leq 10^4

  • 11\leq k \leq nums.length

Examples

Press + to interact
canvasAnimation-image
1 of 4

Understand the problem

Let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the problem correctly:

Split Array Largest Sum

1

What is the largest minimized sum of the following input?

nums = [3,1,2,8,2][3,1,2,8,2]

k = 22

A)

66

B)

88

C)

1010

D)

44

Question 1 of 30 attempted

Figure it out!

We have a game for you to play. Rearrange the logical building blocks to better understand how to solve this problem.

Drag and drop the cards to rearrange them in the correct sequence.

Try it yourself

Implement your solution in the following coding playground.

Press + to interact
Java
usercode > Solution.java
class Solution {
public int splitArray(int[] nums, int k) {
// Replace this placeholder return statement with your code
return -1;
}
}
Split Array Largest Sum

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.