Stuck on This Question

Revision en6, by Utsavcc, 2024-06-17 14:51:06

Given an array of length N with elements array[i] (negative integers inclusive), maximize the Score of the array.

Score of the array = -seg[1]+seg[2]-seg[3]+seg[4].... where all seg[i] are the sum of non-intersecting segments of the array which constitute all of the array when combined We are also provided with an integer K, meaning the array must be divided into K segments.

We aren't given constraints in the problem statement. What is the optimised approach for this question.

Is it DP and if it is then what will be the state

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English Utsavcc 2024-06-17 14:51:06 149
en5 English Utsavcc 2024-06-17 07:25:27 51 Tiny change: 'cases.\n\n' -> 'cases.\n\nIs it DP and if it is then what will be the state\n'
en4 English Utsavcc 2024-06-16 17:00:21 47
en3 English Utsavcc 2024-06-16 15:39:49 4
en2 English Utsavcc 2024-06-16 15:38:54 0 Tiny change: ' + seg[2] — seg[3] + ' -> ' + seg[2] - seg[3] + '
en1 English Utsavcc 2024-06-16 15:23:19 585 Initial revision (published)