I don't get how the output is obtained?

may you please explain how the 22 ouput is formed through the input array … i think answer is to be 12 according to the kadane’s algorithm

Hi Aditya,
Yes,kadanes will give answer as 12.
But in this problem we have to consider the Array as circular i.e. Consider the array as
8 -8 9 -9 10 -11 12
We can also use 8(1st element) after 12(Last Element).i.e. after last element we can also take elements form starting to from our result.
22 is formed as 12 + 8 - 8 + 9 - 9 + 10.