Tap here to switch tabs
Problem
Submissions

Problem: Sum of K Subarrays With Length at Least M

Sum of K Subarrays With Length at Least M asks you to choose k disjoint subarrays from an integer array, each at least m elements long, and return their maximum total sum.

Statement

You are given an integer array nums and two integers k and m.

Find the maximum possible sum of k disjoint subarrays of nums such that each chosen subarray has a length of at least m.

Return this maximum sum.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • 1≤1 \leq k ≤⌊\leq \lfloornums.length // m⌋\rfloor

  • 1≤1 \leq m ≤3\leq 3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of K Subarrays With Length at Least M

Sum of K Subarrays With Length at Least M asks you to choose k disjoint subarrays from an integer array, each at least m elements long, and return their maximum total sum.

Statement

You are given an integer array nums and two integers k and m.

Find the maximum possible sum of k disjoint subarrays of nums such that each chosen subarray has a length of at least m.

Return this maximum sum.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • 1≤1 \leq k ≤⌊\leq \lfloornums.length // m⌋\rfloor

  • 1≤1 \leq m ≤3\leq 3