题目中文:求最长回文子串 题目难度:Medium 题目内容: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 翻译: ...
分类:
编程语言 时间:
2018-03-19 19:09:23
阅读次数:
224
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number ...
分类:
其他好文 时间:
2018-03-10 17:48:20
阅读次数:
199
问题链接 "Leetcode 516" 题目解析 求最长回文子序列。 解题思路 子序列和子串有区别的,子序列不需要连续,相对位置递增即可。 动态规划。对于任意字符串,如果头尾字符相同,那么字符串的最长回文子序列等于去掉首尾的字符串的最长回文子序列加上首尾;如果首尾字符不同,则最长子序列等于去掉头的字 ...
分类:
其他好文 时间:
2018-03-08 17:27:40
阅读次数:
122
问题链接 "Leetcode 647" 题目解析 计算字符串的回文子串数。 解题思路 一个小问题,子串(Substring)、子数组(Subarray)和子序列(Subsequence)的区别:子串和子数组是等同的,特点是 连续的 ,比如[1,2,3]的子串有(1), (2), (3), (1,2) ...
分类:
其他好文 时间:
2018-03-08 14:09:37
阅读次数:
184
题目大意 ? 一个字符串$s$是$1$?回文串当且仅当这个串是回文串。 ? 一个串$s$是$k$?回文串$(k 1)$当且仅当$s$的前一半与后一半相同且$s$的前一半是非空$(k?1)$?回文串。 ? 一个串$s$的前一半是这个串的长度为$\lfloor\frac{|s|}{2}\rfloor$的 ...
分类:
其他好文 时间:
2018-03-05 18:10:26
阅读次数:
196
参考:https://www.felix021.com/blog/read.php?2040,https://segmentfault.com/a/1190000002991199 做了修改。 首先用一个非常巧妙的方式,将所有可能的奇数/偶数长度的回文子串都转换成了奇数长度:在每个字符的两边都插入一 ...
分类:
其他好文 时间:
2018-03-02 22:07:31
阅读次数:
151
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 longes ...
分类:
其他好文 时间:
2018-03-01 17:06:59
阅读次数:
169
A - Palindromic Supersequence B - Recursive Queries C - Permutation Cycle D - Tree E - Team Work F - Escape Through Leaf G - Palindrome Partition ...
分类:
其他好文 时间:
2018-02-24 14:57:45
阅读次数:
202
最长的回文字符串第二部分 原文为英文页面,地址:https://articles.leetcode.com/longest-palindromic-substring-part-ii/ 给定一个字符串S,找到S中最长的回文子字符串。 注意:这是文章的第二部分:最长回文子串。在这里,我们描述了一个算法 ...
分类:
其他好文 时间:
2018-02-23 20:43:57
阅读次数:
217
【链接】 "我是链接,点我呀:)" 【题意】 在这里输入题意 【题解】 字符串倒着加到原串右边就好 【代码】 cpp include using namespace std; int main(){ ifdef LOCAL_DEFINE freopen("rush_in.txt", "r", std ...
分类:
其他好文 时间:
2018-02-18 20:41:19
阅读次数:
188