Split Array Largest Sum
Updated
Problem statement
Given a nonnegative integer array nums and an integer d, split nums into exactly d nonempty contiguous segments.
For a split, calculate the sum of every segment and take the largest segment sum. Return the minimum possible value of that largest sum.
Function
splitArrayLargestSum(nums: int[], d: int) → longExamples
Example 1
nums = [7,2,5,10,8]d = 2return = 18Splitting as [7,2,5] and [10,8] gives segment sums 14 and 18. No two-segment split has a smaller maximum.
Example 2
nums = [1,2,3,4,5]d = 2return = 9The optimal split is [1,2,3] and [4,5], whose largest sum is 9.
Example 3
nums = [1,4,4]d = 3return = 4Exactly three nonempty segments force one element per segment.
Constraints
1 <= nums.length <= 100000.0 <= nums[i] <= 1000000000.1 <= d <= nums.length.- The sum of
numsfits in a signed 64-bit integer.
More Bloomberg LP Onsite Interview questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
- Split Array Largest SumAuxoAI · OA
- Split Array to Minimize the Largest SumNation with NaMo · PHONE SCREEN
- Minimize the Largest Part BeautyAdobe · PHONE SCREENAdobe interview questions
- Russian Doll EnvelopesGoogle · ONSITE INTERVIEWGoogle interview questions
- Minimum Taps to Water a GardenThe D.E. Shaw Group · ONSITE INTERVIEWThe D.E. Shaw Group interview questions
- Allocate Minimum PagesAmazon · ONSITE INTERVIEW
- Minimum Processing Speed with Multiple RidersDoorDash · ONSITE INTERVIEWDoorDash interview questions
- Russian Doll EnvelopesInMobi · ONSITE INTERVIEWInMobi interview questions
- Russian Doll EnvelopesAirbnb · ONSITE INTERVIEWAirbnb interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)