Circular subarray sum

i do not understand the need of inverting sign of every element, how is it helping to find out max sum in case of circular fashin.

we dont calculate anything directly after inverting the elements of array, we just invert all the elements and then apply kadane’s algorithm to find the maximum negative that is there in the non wrapped array, we then subtract it from the total sum of the array to find out the maximum positive in the circular case.

Our array is like a ring and we have to eliminate the maximum continuous negative that implies maximum continuous positive in the inverted arrays.

Hey Archit,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.