Manacher 回文串
文章平均质量分 77
圣诞老人家
这个作者很懒,什么都没留下…
展开
-
Manacher 算法 求最长字回文串
0. 问题定义最长回文子串问题:给定一个字符串,求它的最长回文子串长度。如果一个字符串正着读和反着读是一样的,那它就是回文串。下面是一些回文串的实例:12321 a aba abba aaaa tattarrattat(牛津英语词典中最长的回文单词)1. Brute-force 解法对于最长回文子串问题,最简单粗暴的办法是:找到字符串的所有子串,遍历每一个子串以转载 2017-04-22 19:50:54 · 246 阅读 · 0 评论 -
B - 吉哥系列故事――完美队形II
吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h1 1, h2 2 ... hn n,吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,原创 2017-04-27 21:05:30 · 287 阅读 · 0 评论 -
Girls' research
One day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps:First step: girls will write a long string (only contains lower case原创 2017-04-27 21:08:33 · 342 阅读 · 0 评论 -
I - Mirrored String II Gym - 101350I
Note: this is a harder version of Mirrored string I.The gorillas have recently discovered that the image on the surface of the water is actually a reflection of themselves. So, the next thing for th原创 2017-04-27 21:21:29 · 667 阅读 · 0 评论 -
gym100971
Mihahim has a string s. He wants to delete exactly one character from it so that the resulting string would be a palindrome. Determine if he can do it, and if he can, what character should be dele原创 2017-05-19 11:52:59 · 211 阅读 · 0 评论