Pallindorme using recursion (2 test case fail)

#include
using namespace std;
bool pallindrome(int arr[],int s,int e)
{
if(s==e)
{
return true;
}
if(arr[s]!=arr[e])
{
return false;
}
if(arr[s]==arr[e])
{
pallindrome(arr,s+1,e-1);
return true;
}

}
bool isPallin(int arr[],int temp)
{
if(temp <1)
{
return true;
}
else{
int e,s=0;
e=temp-1;

	pallindrome(arr,s,e);
}

}
int main()
{
int num,temp=0;
cin>>num;
int arr[100];
int j=0;
while(num!=0)
{

	arr[j]=num%10;
	num /=10;
	temp++;
	j++;
}

/*cout<<temp<<endl;
for(int i=0;i<temp;i++)
{
	cout<<arr[i]<<endl;
}*/

if(isPallin(arr,temp)){
	cout<<"true";
}
else{
	cout<<"false";
}

}

mohit save ur code to


and then share the link here

check for test case
5
1 2 3 2 1
u will find error

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.