Maximum circular sub array sum

code is showing wrong ans but checked for diff cases giving the right ans code link is

Hi @vivan.singh
Wrong ans is because you are not checking which is one is more among kadan or kadan+sum. Because it is possible that sum is -ve then your ans that is sum+kadan will not be maximum sub array sum.

Instead you should use this :

int x=kadan(c,n);
cout<<max(sum+x,x)<<endl;