A palindrome reads the same forward and backward. We compare the first and last characters; if they match, we move inward and repeat.
boolean isPalindrome(String s, int start, int end) { if (start >= end) return true; if (s.charAt(start) != s.charAt(end)) return false; return isPalindrome(s, start + 1, end - 1);}When all corresponding pairs match until the middle is reached, the string is a palindrome.