FastPrepSplit Array Largest Sum
Problems/Split Array Largest Sum

Split Array Largest Sum

LinkedIn logoLinkedIn● MediumFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Given an array of integers arr and an integer K. While maintaining the order, split into exactly K pieces such the sum of maximum of every sub-array is minimum.

For example, given arr = [1, 5, 3, 4, 2] and K = 2, the output should be 6. Possible splits are: [[1], [5, 3, 4, 2]], [[1, 5], [3, 4, 2]], [[1, 5, 3], [4, 2]], [[1, 5, 3, 4], [2]]. The minimum sum of maximum would be [1], [5, 3, 4, 2] = 1 + 5 = 6.

Function

splitArrayLargestSum(arr: int[], K: int) → int

Complete the function splitArrayLargestSum in the editor.

splitArrayLargestSum has the following parameters:

  1. 1. int[] arr: an array of integers
  2. 2. int K: the number of pieces to split the array into

Returns int: the minimum sum of the maximums of K sub-arrays

Examples

Example 1

arr = [1, 5, 3, 4, 2]K = 2return = 6

Possible splits are: [[1], [5, 3, 4, 2]], [1, 5], [3, 4, 2], [1, 5, 3], [4, 2], [1, 5, 3, 4], [2]] The minimum sum of maximum would be = [1], [5, 3, 4, 2] = 1 + 5 = 6

Constraints

  • 1 < K <= N < 300
  • 1 < arr[i] < 10^5

More LinkedIn interview questions

  • Allocate Mailboxes with Squared DistanceONSITE INTERVIEW · Seen Nov 2026
  • Find Leaves of a Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Max Points on a LineONSITE INTERVIEW · Seen Nov 2026
  • Maximum Product of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
  • Maximum Sum of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
  • Merge Two Sorted ListsPHONE SCREEN · Seen Nov 2026
  • Sqrt(x)PHONE SCREEN · Seen Nov 2026
  • Total Years of Work ExperiencePHONE SCREEN · Seen Nov 2026
  • Explore an Unknown Grid and Find a PathONSITE INTERVIEW · Seen Nov 2026
  • Fire Station Response BillONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Minimum Cost to Attend Required CoursesVisa · OAVisa interview questions
  • Fill a Time Window with SongsMicrosoft · OAMicrosoft interview questions
  • Maximum Taxi EarningsWells Fargo · OAWells Fargo interview questions
  • Longest Increasing Subsequence from Two ArraysSquarepoint Capital · OASquarepoint Capital interview questions
  • Longest Increasing SubsequenceAtlassian · OAAtlassian interview questions
  • Maximum Profit from an Increasing Price TripletOdoo · OAOdoo interview questions
  • Longest Increasing Subsequence LengthApple · OAApple interview questions
  • Beautiful RowNutanix · OANutanix interview questions
  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions

LinkedIn interview experiences

  • LinkedIn Senior MLE Interview Questions: 1 Experience
  • LinkedIn Staff AI Engineer Phone Screens: 1 Experience
  • LinkedIn Experienced MLE Onsite: 1 Experience
  • LinkedIn Coding with AI Interview: 4 Experiences
  • LinkedIn Experienced Infrastructure SWE Onsite: 1 Experience
All LinkedIn interview questionsSee LinkedIn hiring insights
Saved
class Solution {
    public int splitArrayLargestSum(int[] arr, int K) {
      // write your code here
    }

}
Checking account…