Error In code of the problem

void solve(){
int n;cin>>n;
string s;cin>>s;
bool dp[n][n]={true};
for(int sz=2;sz<=n;sz++){
for(int i=0;i+sz-1<n;i++){
int start=i;int end=i+sz-1;
if(sz==2)
dp[start][end]= s[start]==s[end];
else
dp[start][end]= s[start]==s[end] && dp[start+1][end-1];
}
}
int q;cin>>q;
while(q–){
int l;int r;
cin>>l>>r;
l–;r–;
if(dp[l][r])
cout<<“YES\n”;
else
cout<<“NO\n”;
}

}

Why the code is showing error

hello @tichibandhilki

pls share the complete code with me.
by saving it on cb ide.

btw this is not correct intialisation , it will intialise only first entry of dp table with true, rest wil have false entries

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.