not passing one test case, what is problem in this?
Ispalindrome problem
Hey right now your code will return true even if only one char matches for example
axyza Here also it will return true because a[0]==a[4]
So instead the function should be like this
bool ispalindrome(int a[],int n)
{
for(int i=0,j=n-1;i<=j;i++,j–)
{
if(a[i]!=a[j])
return false;
}
return true;
}
Here will retrun false if characters dont match and once we get out of loop ,we know that every character matched and its a palindrome(because if it wasn’t then it would have returned from the loop itself) so we return true.