问题描述: 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 ...
分类:
其他好文 时间:
2016-10-14 00:31:17
阅读次数:
185
String类: .Length 字符的长度 .Trim() 去掉开头以及结尾的空格 .TrimStart() 去掉字符串开头的空格 .TrimEnd() 去掉字符串后面的空格 .ToUpper() 全部大写 .ToLower() 全部小写 Substring(起始位置,截取长度) Substrin ...
分类:
其他好文 时间:
2016-10-12 22:45:44
阅读次数:
164
题目如下: 此题用Manacher算法求解,时间复杂度为O(n) Python代码: ...
分类:
其他好文 时间:
2016-10-07 14:07:23
阅读次数:
151
写了一个爆搜,超时了,所以更改了一个方法,使用flag数组记录标志, 动态规划,类似于lcs的解法,数组flag[i][j]记录s从i到j是不是回文 首先初始化,i>=j时,flag[i][j]=true,这是因为s[i][i]是单字符的回文,当i>j时,为true,是因为有可能出现flag[2][ ...
分类:
其他好文 时间:
2016-10-02 19:36:57
阅读次数:
146
题目链接:http://lightoj.com/volume_showproblem.php?problem=1205 题意:求[l,r]内回文数的数量。 dp(s,l,ok)表示数字以s为开头,长度为l的时是/不是回文数 dp(s,l,ok)可以由dp(s,l-1,ok)更新来,当且仅当接下来插入 ...
分类:
其他好文 时间:
2016-10-02 17:16:05
阅读次数:
131
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 ...
分类:
其他好文 时间:
2016-10-01 12:30:06
阅读次数:
100
题目来自 https://leetcode.com/problems/longest-palindromic-substring/ 题目:Given a string S, find the longest palindromic substring in S. You may assume tha ...
分类:
其他好文 时间:
2016-09-25 17:26:09
阅读次数:
149
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 ...
分类:
其他好文 时间:
2016-09-20 06:49:11
阅读次数:
141
P1206 [USACO1.2]回文平方数 Palindromic Squares 271通过 501提交 题目提供者该用户不存在 标签USACO 难度普及- 提交 讨论 题解 最新讨论 暂时没有讨论 题目描述 回文数是指从左向右念和从右向左念都一样的数。如12321就是一个典型的回文数。 给定一个 ...
分类:
其他好文 时间:
2016-09-19 22:19:32
阅读次数:
193
问题描述: 给定一个字符串S,找出它的最大的回文子串,你可以假设字符串的最大长度是1000,而且存在唯一的最长回文子串 。 思路分析: 动态规划的思路:dp[i][j] 表示的是 从i 到 j 的字串,是否是回文串。 则根据回文的规则我们可以知道: 如果s[i] == s[j] 那么是否是回文决定于 ...
分类:
其他好文 时间:
2016-09-14 20:41:45
阅读次数:
131