Dp mcq ..pls explain this question and what will be the ans

Given an array A consisting of n integers , we define beauty of the array as maximum sum of some contiguous elements with performing atmost one operation which is , you can multiply any subarray with ‘x’ but only once.

What will be the maximum subarray sum for this input

N=5,x=-2

A=[-3,8,-2,1,-6]

(Bonus :: Can you write the effiicient code for it ?

Hi @divisharoy14_5d0aa86c37c6588a, multiply the subarray
-2 1 -6 by x
u get
-3 8 4 -2 12
take the sum of
8 4 -2 12
which is 22
that is the answer

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.