Isme bhi bta do sir

#include
using namespace std;
int kadenealgo(int a[],int n)
{
int cs=0,ms=0;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
{
cs=cs+a[i];
if(cs<0)
cs=0;
ms=max(cs,ms);
}
return ms;
}

int circularsum(int a[],int n)
{
int c1 = kadenealgo(a,n);
int c2=0;
for(int i=0;i<n;i++)
{
c2 += a[i];
a[i] = -a[i];
}
c2 = c2 + kadenealgo(a,n);
return (c2 > c1) ? c2:c1;
}
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
int a[1000];
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
cout<<circularsum(a,n);
}
return 0;
}

hello @ahujaxrhythm

pls save ur code at cb ide and share its link with me

check now

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.