Max Sum Subarray of atleast 2 numbers

Revision en1, by Timosh, 2024-04-20 19:37:16

Hello Codeforces. Recently I faced a problem which I couldn't solve in an hour. It is as follows: Max Sum Subarray of atleast 2 numbers. Of course, for just max sum subarray it is Kadane's algorithm in O(n) time, however, I couldn't think of a way to solve for atleast 2 numbers faster than O(n^2). Any idea or a solution?

Tags problem, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Timosh 2024-04-20 20:39:35 66
en1 English Timosh 2024-04-20 19:37:16 362 Initial revision (published)