Question : maximun circular sum

In maximun circular sum question,

MY approach is to separate all circular arrays (that is 1st array would start from index 0 to n-1. 2nd array will start from index 1 to 0, 3rd from index 2 to 1 and so on…)
after separating i will apply kadanes algorithm on each array and compare them to find maximum sum

here is the solution i am trying to implement but am stuck with segmentation fault .


i have removedsegmentation fault
but the answer is wrong

refer to the explanation here to understand a efficient approach