Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

Split Array Largest Sum

Hard

Topics
ArrayBinary SearchGreedy

Given an array nums and an integer target (= k), split nums into target non-empty contiguous subarrays so as to minimize the largest subarray sum. Return that minimized largest sum.

Example 1

Input:  nums = [7,2,5,10,8], target = 2
Output: 18

Example 2

Input:  nums = [1,2,3,4,5], target = 2
Output: 9

Example 3

Input:  nums = [1,4,4], target = 3
Output: 4

Constraints

  • 1 <= nums.length <= 1000
  • 0 <= nums[i] <= 10^6
  • 1 <= target <= nums.length
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access