Please read the new rule regarding the restriction on the use of AI tools. ×

Is my logic correct for the problem related to Kadanes's algorithm?

Revision en2, by white_square, 2023-03-14 20:18:10

The original problem is : 1373D - Maximum Sum on Even Positions

My Approach

Now the approach was correct if we have to reverse only one subarray.

But what if, we can reverse a number of subarray, suppose K. How would that be solved? I came up with the following approach, is it correct?

Approach

Is my approach correct? Please do share your approach too. Thank you.

Tags kadane, white_square

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English white_square 2023-03-14 20:28:46 0 (published)
en4 English white_square 2023-03-14 20:28:21 241
en3 English white_square 2023-03-14 20:18:40 4
en2 English white_square 2023-03-14 20:18:10 12 Tiny change: 'ank you.\nwhite_square' -> 'ank you.\n'
en1 English white_square 2023-03-14 20:17:38 1240 Initial revision (saved to drafts)