Circular subarrays problems

Here what will be the benefits of changing the sign of the arrays elements and then sum both the return value of kadane algo, I understand the code but don’t get why we are doing this means how to approach the solution?

Hey @Vikaspal
The inverted array Kadane finds minimum sum value that can be obtained in the middle of the array. When you subtract that it gives maximum sum for corners of array.

can please explain with an example supose we have the arrays like
a[] = {8,-8,9,-9,10,-11,12};
we wiil get the max sum in that case is 12 , after inverting
{-8,8,-9,9,-10,11,-12} get the max sum is 11 which you saying that its is minsum of the arrays but when we sum all the elements ans is -11 which is max sum of the inverted arrays and what are the corner case?

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.