(X) leetcode_5 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.

1.暴力法

public static String longestPalindrome(String str) {
        Map resultMap = new HashMap();
        int max = 0;
        String longStr = "";
        for(int i = 0 ;i

提交后时间超时,emmm 毕竟N^3 。
未完待续

你可能感兴趣的:(算法)