mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										38
									
								
								算法题(国外版)/split-array-largest-sum.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								算法题(国外版)/split-array-largest-sum.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<p>Given an array <code>nums</code> which consists of non-negative integers and an integer <code>m</code>, you can split the array into <code>m</code> non-empty continuous subarrays.</p>
 | 
			
		||||
 | 
			
		||||
<p>Write an algorithm to minimize the largest sum among these <code>m</code> subarrays.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> nums = [7,2,5,10,8], m = 2
 | 
			
		||||
<strong>Output:</strong> 18
 | 
			
		||||
<strong>Explanation:</strong>
 | 
			
		||||
There are four ways to split nums into two subarrays.
 | 
			
		||||
The best way is to split it into [7,2,5] and [10,8],
 | 
			
		||||
where the largest sum among the two subarrays is only 18.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 2:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> nums = [1,2,3,4,5], m = 2
 | 
			
		||||
<strong>Output:</strong> 9
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 3:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> nums = [1,4,4], m = 3
 | 
			
		||||
<strong>Output:</strong> 4
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</strong></p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
	<li><code>1 <= nums.length <= 1000</code></li>
 | 
			
		||||
	<li><code>0 <= nums[i] <= 10<sup>6</sup></code></li>
 | 
			
		||||
	<li><code>1 <= m <= min(50, nums.length)</code></li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user