What is wrong in this code?

#include
#include
using namespace std;
void max_circularsum(int temp[],int temp_size){
int max_sum=INT_MIN;
int sum=0;
for(int m=0;m<temp_size;m++){
for(int j=m;j<temp_size;j++){
for(int k=m;k<=j;k++){
sum+=temp[k];
}
if(max_sum<sum){
max_sum=sum;
}
}
}
cout<< max_sum;
}
int main() {
int t,n,A[100],temp[100];
cin>>t;
while(t–){
cin>>n;
for(int i=0;i<n;i++){
cin>>A[i];
}
for(int i=0;i<n;i++){
temp[i]=A[i];
}
for(int i=n;i<2n;i++){
temp[i]=A[i];
}
int temp_size=2
n;
max_circularsum(temp,temp_size);

}

return 0;

}

hi @aishnee3sapra_80178610ab2d7d84,

  1. `temp[i] = a[i-n]
  2. use normal kadane for each n sized window in the function

check here : https://ide.codingblocks.com/s/660514

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.