Skip to content

Files

Latest commit

e1abef0 · Mar 17, 2020

History

History
67 lines (26 loc) · 1.05 KB

File metadata and controls

67 lines (26 loc) · 1.05 KB

Description

Given an integer array A, you partition the array into (contiguous) subarrays of length at most K.  After partitioning, each subarray has their values changed to become the maximum value of that subarray.

Return the largest sum of the given array after partitioning.

 

Example 1:

Input: A = [1,15,7,9,2,5,10], K = 3

Output: 84

Explanation: A becomes [15,15,15,9,10,10,10]

 

Note:

    <li><code>1 &lt;= K &lt;= A.length&nbsp;&lt;= 500</code></li>
    
    <li><code>0 &lt;= A[i] &lt;= 10^6</code></li>
    

Solutions

Python3

Java

...