boolean dp[][] = new boolean[n][n];
// dp记录是否为回文
for(int len = 1; len <= n; ++len){
for(int i = 0; i <= n - len; ++i){
int j = i + len - 1;
dp[i][j] = s.charAt(i) == s.charAt(j) && (len < 3 || dp[i+1][j-1]);
}
}