The hint solution is not clear can u please explain!
if we go on doing s(l,r)=s(l+1,r+1) how we would get all the queries covered.
Palindromic Queries
see bascially
0 1 2 3 4 5 6
6 5 4 3 2 1 0
thats how we are matching the string
so bascially lets suppose the pointers are at the extremen corner
l , r
if these two elements are equal , we contract the windows from both the left and right side, ie the pointers now point to l+1 , r-1 … we continue to recur until l+1 == r
[l,r] [l+1 , r-1] [l+2,r-2] [l+3,r-3] … then at some point the base condition l== r or l+1 == r becomes true
in this way we cover all the elements ,
at any point if str[l] != str[r] then it returns false and final false is returned…
So, this is the case when s[l] and s[r] are same but what about when they are not
if(l == r or l == r+1) return true;
if(str[l] != str[r] ) return false;
return str[l]==str[r] && fn(str , l+1 , r-1 ) ;
since we are using the && function, so if they are not equal false is returned.