Build a DP table bottom-up. For each pair (j, i), check if the outer characters match and the inner substring is already a palindrome.