1031. Maximum Sum of Two Non-Overlapping Subarrays
https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays
Description
Given an integer array nums
and two integers firstLen
and secondLen
, return the maximum sum of elements in two non-overlapping subarrays with lengths firstLen
and secondLen
.
The array with length firstLen
could occur before or after the array with length secondLen
, but they have to be non-overlapping.
A subarray is a contiguous part of an array.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= firstLen, secondLen <= 1000
2 <= firstLen + secondLen <= 1000
firstLen + secondLen <= nums.length <= 1000
0 <= nums[i] <= 1000
ac
Last updated