Largest Sum of 3 Non-Overlapping Sublists
Given a list of integers nums
and an integer k
, return the largest sum of three non-overlapping sublists of nums
each of size k
.
Constraints
n ≤ 100,000
wheren
is the length ofnums
.
https://binarysearch.com/problems/Largest-Sum-of-3-Non-Overlapping-Sublists
Examples
Example 1
Input
- nums =
[1, 1, 1, -5, 3, 3, 3, -7, 2, 2, 2]
- k =
3
Output
- answer =
18
Explanation
We can pick the following sublists [1, 1, 1]
, [3, 3, 3]
, and [2, 2, 2]
.
Leave a comment