
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Split Array Largest Sum
								Certification: Advanced Level
								Accuracy: 0%
								Submissions: 0
								Points: 15
							
							Write a C program to split an array into k non-empty subarrays such that the largest sum among these subarrays is minimized. Given an integer array nums and an integer k, find the minimized largest sum of the split.
Example 1
- Input: nums = [7,2,5,10,8], k = 2
 - Output: 18
 - Explanation: 
- Split the array into [7,2,5] and [10,8]. 
 - Sum of first subarray: 7+2+5 = 14. 
 - Sum of second subarray: 10+8 = 18. 
 - The largest sum is max(14, 18) = 18. 
 - This is the minimum possible largest sum.
 
 - Split the array into [7,2,5] and [10,8]. 
 
Example 2
- Input: nums = [1,2,3,4,5], k = 2
 - Output: 9
 - Explanation: 
- Split the array into [1,2,3,4] and [5]. 
 - Sum of first subarray: 1+2+3+4 = 10. 
 - Sum of second subarray: 5. 
 - The largest sum is max(10, 5) = 10. 
 - Better split: [1,2,3] and [4,5] gives max(6, 9) = 9.
 
 - Split the array into [1,2,3,4] and [5]. 
 
Constraints
- 1 ≤ nums.length ≤ 1000
 - 0 ≤ nums[i] ≤ 10^6
 - 1 ≤ k ≤ min(50, nums.length)
 - Time Complexity: O(n * log(sum) * k)
 - Space Complexity: O(1)
 
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Use binary search on the answer - search between max element and sum of all elements
 - For each potential answer, check if it's possible to split array into k subarrays
 - Use a greedy approach to verify if a given sum limit allows k splits
 - The minimum possible answer is the maximum element in the array
 - The maximum possible answer is the sum of all elements
 - Binary search will find the minimum valid largest sum