Test cases not satisfied with code example and hanges in code according to that

#include
using namespace std;

int main() {
int a[1000]={0};
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
int i=0;
int j=n-1;
int count=0;
while(i<j){
if(a[i]==a[j]){
count++;
if(count==n/2){
cout<<“true”;
}
}else{
cout<<“false”;
}
i++;
j–;
}
if(n==0 || n==1){
cout<<“true”;
}
return 0;
}

@neelrai906
hello neel,

a) put this condition outside ur while loop.
b) inside while loop if a[i]!=a[j] then break

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.