class GfG
{
public static int palinArray(int[] a, int n)
{
int k;
int s=0;
int m=1;
int remainder;
for(int i=0;i<n;i++){
k=a[i];
while(a[i]!=0){
remainder=a[i]%10;
s=s*10+remainder;
a[i]=a[i]/10;
}
if(k!=s){
m=0;
break;
}
else
m=1;
}
return m;
}
}
I tried to take each element of the array and check whether it is palindrome or not. If all the elements in the given array is palindrome then it should return 1 and if it's not then it should return 0.
for example input 5 111 222 333 444 555 expected output 1 My output 0
Thanks for the help.