Still none of the testcase is working...what is wrong?

#include
using namespace std;
bool palindrome(int a[],int n)
{
for(int j=0;j<n;j++)
{
if(a[j]==a[n-j-1])
return true;
else
return false;
}
}
int main()
{ int n;
cin>>n;
int arr[1000];
for(int i=0;i<n;i++)
{ cin>>arr[i];
}
cout<<palindrome(arr,n);
return 0;
}

@Vibhuti0206 Your palindrome function is wrong. It will return true just by checking the first and the last character. You are not performing the other comparisons…the 2nd with the 2nd last character, 3rd with 3rd last character and so on.

Refer this code for palindrome.