Partition Array for Maximum Sum
Given an integer arrayA
, you partition the array into (contiguous) subarrays of length at mostK
. 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:
分析
和上面书架题一模一样,记住这里求本段的max不能合在一起做,可能是Python计算顺序问题
Last updated