My solution for the maximum circular sum is failing on one test case. Can anybody let me know the issue in the code?
`#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–) {
int n;
cin>>n;
int sum=0;
int flag=0;
int arr[n];
for(int i=0; i<n; i++) {
cin>>arr[i];
if(arr[i]>0) {
flag=1;
}
}
int m=arr[0];
for(int i=0; i<n; i++) {
if(m< arr[i]) {
m= arr[i];
}
}
if(flag==0){
cout<<m<<endl;
}
else {
for(int i=0;i<n;i++) {
sum += arr[i];
arr[i]= -arr[i];
}
int currSum=0;
int maxSum= 0;
for(int i=0;i<n;i++) {
currSum= max(currSum+arr[i], arr[i]);
maxSum= max(maxSum, currSum);
}
//cout<<sum;
maxSum= -((-sum)-maxSum);
cout<<maxSum<<endl;
}
}
return 0;
}`