Skip to content

Commit b905737

Browse files
committed
Create README - LeetHub
1 parent 0ba0695 commit b905737

File tree

1 file changed

+33
-0
lines changed
  • 1043-partition-array-for-maximum-sum

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/partition-array-for-maximum-sum/">1043. Partition Array for Maximum Sum</a></h2><h3>Medium</h3><hr><div><p>Given an integer array <code>arr</code>, partition the array into (contiguous) subarrays of length <strong>at most</strong> <code>k</code>. After partitioning, each subarray has their values changed to become the maximum value of that subarray.</p>
2+
3+
<p>Return <em>the largest sum of the given array after partitioning. Test cases are generated so that the answer fits in a <strong>32-bit</strong> integer.</em></p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> arr = [1,15,7,9,2,5,10], k = 3
9+
<strong>Output:</strong> 84
10+
<strong>Explanation:</strong> arr becomes [15,15,15,9,10,10,10]
11+
</pre>
12+
13+
<p><strong class="example">Example 2:</strong></p>
14+
15+
<pre><strong>Input:</strong> arr = [1,4,1,5,7,3,6,1,9,9,3], k = 4
16+
<strong>Output:</strong> 83
17+
</pre>
18+
19+
<p><strong class="example">Example 3:</strong></p>
20+
21+
<pre><strong>Input:</strong> arr = [1], k = 1
22+
<strong>Output:</strong> 1
23+
</pre>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Constraints:</strong></p>
27+
28+
<ul>
29+
<li><code>1 &lt;= arr.length &lt;= 500</code></li>
30+
<li><code>0 &lt;= arr[i] &lt;= 10<sup>9</sup></code></li>
31+
<li><code>1 &lt;= k &lt;= arr.length</code></li>
32+
</ul>
33+
</div>

0 commit comments

Comments
 (0)