Skip to content

Commit a1e6274

Browse files
refactor 1043
1 parent 9710743 commit a1e6274

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/main/java/com/fishercoder/solutions/_1043.java

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 1043. Partition Array for Maximum Sum
5-
*
6-
* 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.
7-
* Return the largest sum of the given array after partitioning.
8-
*
9-
* Example 1:
10-
* Input: A = [1,15,7,9,2,5,10], K = 3
11-
* Output: 84
12-
* Explanation: A becomes [15,15,15,9,10,10,10]
13-
*
14-
* Note:
15-
* 1 <= K <= A.length <= 500
16-
* 0 <= A[i] <= 10^6
17-
* */
183
public class _1043 {
194
public static class Solution1 {
20-
/**credit: https://leetcode.com/problems/partition-array-for-maximum-sum/discuss/290863/JavaC%2B%2BPython-DP*/
5+
/**
6+
* credit: https://leetcode.com/problems/partition-array-for-maximum-sum/discuss/290863/JavaC%2B%2BPython-DP
7+
*/
218
public int maxSumAfterPartitioning(int[] A, int K) {
229
int N = A.length;
2310
int[] dp = new int[N];

0 commit comments

Comments
 (0)