Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sum of M Non-Overlapping Subarrays I

Try to solve the Maximum Sum of M Non-Overlapping Subarrays I problem.

Statement

You are given an integer array nums and three integers m, l, and r.

Select at least 11 and at most m pairwise disjoint subarrays from nums such that the length of each chosen subarray is between l and r, inclusive.

Return the maximum possible total sum of the elements in the chosen subarrays.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤1000\leq 1000

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq m ≤\leq n

  • 1≤1 \leq l ≤\leq r ≤\leq n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sum of M Non-Overlapping Subarrays I

Try to solve the Maximum Sum of M Non-Overlapping Subarrays I problem.

Statement

You are given an integer array nums and three integers m, l, and r.

Select at least 11 and at most m pairwise disjoint subarrays from nums such that the length of each chosen subarray is between l and r, inclusive.

Return the maximum possible total sum of the elements in the chosen subarrays.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤1000\leq 1000

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq m ≤\leq n

  • 1≤1 \leq l ≤\leq r ≤\leq n