【DP&字符串】Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

用DP,d[i][j]表示字符串i到j是否为回文

public class Solution {
    public String longestPalindrome(String s) {
        int max = 0;
        int len = s.length();
        int maxL = 0;
        int maxR = 0;
        for(int i=0; i=0 && r=0 && r


你可能感兴趣的:(LeetCode)