uva 10739 String to PalindromeIn this problem you are asked to convert a string into a palindrome with minimum number of operations. The operations are described below:Here you’d have the ultimate free...
分类:
其他好文 时间:
2015-04-07 10:02:16
阅读次数:
119
题目大意给出一个字符串,求出这个字符串的最长回文子串。思路前来学习著名的Manacher算法。
这是一个线性时间求出回文子串的算法。具体来说,对于我们弄出的一个回文串,它对于后面的串并不是,没有用的,因为它的左右两侧是相同的,那么自然可以用左边的信息去更新右边。
设p[i]p[i]为第ii个字符的回文半径,_max\_max为max{p[i]+i}max\{p[i] + i\},也就是最远可以更...
分类:
其他好文 时间:
2015-04-07 09:47:35
阅读次数:
119
LeetCode #Palindrome Number#
又是个软柿子啊...(主要是今天不知道在哪儿看到一个回文的题目了,然后就特地去LeetCode找了一下,还真有,一次性AC的感觉简直不能再爽)
我的Python版本解答:
"""
Programmer : EOF
E-mail : jasonleaster@gmail.com...
分类:
其他好文 时间:
2015-04-07 00:46:13
阅读次数:
203
https://leetcode.com/problems/palindrome-partitioning/Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all...
分类:
其他好文 时间:
2015-04-06 15:23:49
阅读次数:
112
Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
...
分类:
其他好文 时间:
2015-04-05 22:00:12
阅读次数:
127
这道题采用动态规划的思想。参考了别人的做法。class Solution{public: vector> result; vector> partition(string s) { int len = s.length(); vector soloresult; if(s.leng...
分类:
其他好文 时间:
2015-04-05 18:47:49
阅读次数:
141
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2015-04-05 17:20:10
阅读次数:
97
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:
其他好文 时间:
2015-04-05 15:53:15
阅读次数:
107
一:Reverse Integer
题目:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
链接:https://leetcode.com/problems/reverse-integer/
分析:这题通过不断取余将余数存放在一个vecto...
分类:
其他好文 时间:
2015-04-05 14:40:31
阅读次数:
161
??
问题描述:
Determine whether an integer is a palindrome. Do thiswithout extra space.
click to showspoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If yo...
分类:
其他好文 时间:
2015-04-04 09:18:33
阅读次数:
137