# 关键点二:又一关键点,只有首尾相同才可能是回文串,要比只用 x == x[::-1] 优 #ms, m = x, j-i+1 # x 一定比原来的 ms 长,一开始想的是 m += 1,结果可能几个以后才是回文子串。 ms = x return ms 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. ...
sconsist of only digits and English letters (lower-case and/or upper-case), Ideas: 1. 利用 来建一个palin, T: O(n * n) , S: O(n * n), 然后再用两个for loop 去看是否为palin,再更新ans及ans_length, 但是Leetcode上Time Limit Exceeded. Code classSolution:deflongestPalindrome(self, s...
[LeetCode] 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. Example 1: Example 2: 以下说明转载自: https://leetcode.com/problems/lon... ...
4. 【Leetcode】【Easy】Compare Version Numbers(1154) 5. 【Leetcode】【Hard】Merge k Sorted Lists(916) 评论排行榜 1. 认真分析mmap:是什么 为什么 怎么用(38) 2. 从内核文件系统看文件读写过程(17) 3. 倒排索引压缩:改进的PForDelta算法(1) ...