I have tried to implement the basic recursive solution as shown in hint video.Can i know why is it wrong?
#include
#include
int func(int i,int j,std::string str)
{
if(i>=j)
return 1;
return func(i+1,j-1,str) && str[i]==str[j];
}
int main () {
int i,j,n,t,l,r;
std::string str;
std::cin>>n;
std::cin>>str;
std::cin>>t;
while(t–)
{
std::cin>>l>>r;
std::cout<<func(l,r,str);
}
}