I would try to replace
return isPal(s.substring(1, s.length()-1));
with
return isPal(s.substring(1, s.length()-2));
Quote:
i want best program for this question with time and space complexity
If not for learning purpose, recursion is a bad solution, a loop will be more efficient.