E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
palindrome
Codeforces 335B
Palindrome
鸽巢原理 + DP
题目大意:就是现在给出一个长度不超过5*10^4的串,求其最长回文串,如果回文串长度超过100只需要输出长度为100的即可,输入的字符串只包含26种小写英文字母另外就是这个题目中的回文串并不要求在原来的串当中是连续出现的,只需要出现的位置顺序一样即可,并不要求连续大致思路:做练习的时候一眼看标题课描述没看Hint就脑补直接当常见的的连续的回文串来做了....上来就敲了一发后缀数组结果发现样例没过然
u013738743
·
2015-03-03 19:00
dp
codeforces
palindrome
鸽巢原理
335B
[LeetCode]132.
Palindrome
Partitioning II
题目Givenastrings,partitionssuchthateverysubstringofthepartitionisa
palindrome
.Returntheminimumcutsneededfora
palindrome
partitioningofs.Forexample
SunnyYoona
·
2015-03-02 23:00
LeetCode
动态规划
经典面试题
回文串
[LeetCode]131.
Palindrome
Partitioning
题目Givenastrings,partitionssuchthateverysubstringofthepartitionisa
palindrome
.Returnallpossible
palindrome
partitioningofs.Forexample
SunnyYoona
·
2015-03-02 21:00
LeetCode
经典面试题
回文串
Palindrome
Number (Easy) (C++/Java/Python)
索引:[LeetCode]Leetcode题解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode009.
Palindrome
_Number
hcbbt
·
2015-03-01 10:00
java
LeetCode
C++
算法
python
[待续]Minimum appends to convert string into
palindrome
Convertthegivenstringinto
palindrome
withminimumnumberofappends(atendofthegivenstring).O(n)algorithmwillbeappreciated.Input
yuanhsh
·
2015-02-28 15:00
palindrome
[待续]Minimum appends to convert string into
palindrome
Convert the given string into
palindrome
with minimum number of appends(at end of the given string).
yuanhsh
·
2015-02-28 15:00
palindrome
LeetCode—
Palindrome
Number
受到上个题的启发,先把intreverse了然后判断是否和原来的数字相等。这样做的话averagecase时间复杂度高看到了别人的解法是用两个指针,只要判断到一位不想等就返回,平均复杂度低一些,但是怎么用指针不好想。他实际上指针就是这一位的base比如10,100,1000然后用x分别除以左右两个对应的指针再去余实际上就是取了这个位置的数字。我的代码publicclassSolution{ pub
bsbcarter
·
2015-02-26 11:00
[待续]Convert string to
palindrome
string with minimum insertions
Givenastring,findtheminimumnumberofcharacterstobeinsertedtoconvertitto
palindrome
.
yuanhsh
·
2015-02-26 05:00
palindrome
[待续]Convert string to
palindrome
string with minimum insertions
Givenastring,findtheminimumnumberofcharacterstobeinsertedtoconvertitto
palindrome
.
yuanhsh
·
2015-02-26 05:00
palindrome
LeetCode-Valid
Palindrome
publicclassSolution{ publicbooleanis
Palindrome
(Strings){ if(s==null||s.length()==0) returntrue; s=s.replaceAll
bsbcarter
·
2015-02-24 11:00
UVA 10716 Evil Straw Warts Live
EvilStrawWartsLiveA
palindrome
isastringofsymbolsthatisequaltoitselfwhenreversed.Givenaninputstring,notnecessarilya
palindrome
jtjy568805874
·
2015-02-18 14:00
uva
贪心
Palindrome
Partitioning II
1.
palindrome
[i][j]==true,表示s[i,...,j](i>
palindrome
(s.size(),vector(s.size(),false)); intdp[s.size()+1
u014674776
·
2015-02-15 13:00
LeetCode
C++
dp
动态规划
Palindrome
Partitioning
递归切分回文串即可。代码:classSolution { public: vector>partition(strings) { vectorcur; recurse(s,cur); returnret; } private: voidrecurse(conststring&s,vector&cur) { if(s.size()==0) { ret.push_back(cur); } for(s
u014674776
·
2015-02-15 11:00
LeetCode
C++
recurse
Palindrome
Partitioning II Leetcode Python
Givenastring s,partition s suchthateverysubstringofthepartitionisa
palindrome
.Returntheminimumcutsneededfora
palindrome
partitioningof
hyperbolechi
·
2015-02-15 00:00
LeetCode
dp
python
动态规划
UVa 11151 - Longest
Palindrome
(区间dp)
题意:求一个字符串任意去掉零个或多个字符后,中最长的回文串的长度。解法:由于是求长度,所以我们可用状态方程:d[i][j]表示在区间i~j内的最大回文子串,边界条件为d[i][i]=1;d[i][j]=d[i+1][j-1]+2;str[i]==str[j]d[i][j]=max(d[i+1][j],d[i][j-1]);str[i]!=str[j]注意:题目说空串也是回文子串,长度为0。#inc
HelloWorld10086
·
2015-02-14 18:00
uva
11151
Valid
Palindrome
- LeetCode
Valid
Palindrome
-LeetCode题目:Givenastring,determineifitisa
palindrome
,consideringonlyalphanumericcharactersandignoringcases.Forexample
u010006643
·
2015-02-13 23:00
LeetCode
python
Palindrome
Number
Determine whether an integer is a
palindrome
. Do this without extra space.
plan454
·
2015-02-13 22:00
number
hdu 3376 Finding
Palindrome
s (kmp+Tire)
题意:给出n个串,n个串可以任意两两组合,求回文的个数。题解:纯恶心的题目,完全没有意义,全部操作只能在一个字符数组上处理,相当于一个字符数组成为n个串的公用。代码还没写完。。。。#include #include #include #include #include #include #include usingnamespacestd; //typedeflonglonglld; consti
My_ACM_Dream
·
2015-02-13 21:00
(1513)HDU-lcs+滚动数组
Palindrome
ProblemDescriptionA
palindrome
isasymmetricalstring,thatis,astringreadidenticallyfromlefttorightaswellasfromrighttoleft.Youaretowriteaprogramwhich
wang57389675
·
2015-02-12 12:00
LeetCode 题解(71):
Palindrome
Number
题目:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.clicktoshowspoilers.Somehints:Couldnegativeintegersbe
palindrome
s
u011029779
·
2015-02-11 08:00
Algorithm
LeetCode
面试题
LeetCode-
Palindrome
Partitioning
Givenastring s,partition s suchthateverysubstringofthepartitionisa
palindrome
.Returnallpossible
palindrome
partitioningof
My_Jobs
·
2015-02-09 20:00
URAL 1297
Palindrome
后缀数组 或 Manacher 求最长回文子串
题目大意:就是给出一个长度不超过1000个只包含大小写英文字母的字符串,输出其最长回文子串大致思路:解法一:首先很容易想到用将该字符串本身反转之后与自己连接起来,中间用一个未出现的字符隔开,求出后缀数组刚开始想的是枚举回文串长度,但是发现不能二分判断改长度是否就满足题意,于是想到一个枚举起点和长度利用RMQ查询和对称性判断的O(n*n)的方法不过这样并不是最好的枚举方法我们可以枚举回文串的中间字符
u013738743
·
2015-02-09 19:00
后缀数组
palindrome
Manacher
回文串
ural
1297
[置顶] codeforces 137D
Palindrome
s (dp神题路基打印)
题意:求一个串分成k个回文串需要的最少操作数,这个操作是指将串的某个位置的值改变以使得分成的串能够成为回文。题解:感觉神题啊,路径打印十分困难。第一、我们要预处理下区间[i,j]上串变成回文的操作数!这步要用到区间dp来预处理,不断划分区间跟新。第二、dp计算出最小的操作数,dp[i][j]表示前j个点分成i份回文串需要的最小操作数。第三、获取,这就需要第二步中dp的值来倒推得到路径通过这个判断:
My_ACM_Dream
·
2015-02-09 15:00
UVA 11584 Partitioning by
Palindrome
s DP
题目链接n2的预处理i~j是不是回文串然后n2的DP11584Partitioningby
Palindrome
sCanyoureadupside-down?
u012797220
·
2015-02-09 14:00
后缀数组(最长回文子串)——ural 1297
对应ural题目:点击打开链接
Palindrome
TimeLimit: 1000MS MemoryLimit: 65536KB 64bitIOFormat: %I64d&%I64uSubmit StatusDescriptionThe
u013351484
·
2015-02-08 15:00
回文判断
题目描述回文,英文
palindrome
,指一个顺着读和反过来读都一样的字符串,比如madam、我爱我,这样的短句在智力性、趣味性和艺术性上都颇有特色,中国历史上还有很多有趣的回文诗。
qisefengzheng
·
2015-02-07 18:00
【Project Euler】4 第四题
//Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
NoMasp
·
2015-02-07 12:00
【LeetCode从零单排】No.9
Palindrome
Number
Palindrome
就是判断一个整数是否对称。
gshengod
·
2015-02-07 11:00
java
LeetCode
leetcode:
Palindrome
Number
一、 题目试确定一个整数是否为回文数。并不使用额外的空间。提示:负整数可能是回文数吗?(例如 -1)如果你想要将整数转换成字符串,那么你注意到不能使用额外的空间的限制。可能你尝试翻转整数,但是,如果你已经解决这个问题“逆向整型”,你要知道,颠倒整数可能会溢出的情况。那么你会如何处理这样的情况呢?要有解决这个问题的一种更通用的方法。二、 分析了解题目的意思后,其实问题本身很简单的,一想到回文数脑海中
u010893129
·
2015-02-06 14:00
LeetCode
遍历
reverse
poj3280--Cheapest
Palindrome
(区间dp)
Cheapest
Palindrome
TimeLimit:2000MS MemoryLimit:65536KTotalSubmissions:6186 Accepted:3014DescriptionKeepingtrackofallthecowscanbeatrickytasksoFarmerJohnhasinstalledasystemtoautomateit.Hehasinstalledone
u013015642
·
2015-02-05 17:00
判断一个整数是否为回文数
回文数比如:12321,1331,1001.classSolution{ public: boolis
Palindrome
(intx){ if(x=10) { div*=10; } while(x>0
brucehb
·
2015-02-05 00:00
UVA 10453 Make
Palindrome
(区间dp-补全回文串+打印结果)
题目大意:给一个字符串,要求添加最少个字符,把它变成回文串,并输出。思路:区间dp,dp[i][j]表示区间(i,j)内的字符串添加的最少个数,变成回文串那么,如果str[i]==str[j],dp[i][j]=dp[i+1][j-1]+1否则dp[i][j]=min{dp[i+1][j],dp[i][j-1]}+1;题目要输出方案,那么只要再开一个数组,根据状态转移递归输出即可#include
HelloWorld10086
·
2015-02-04 10:00
uva
10453
[LeetCode]
Palindrome
Partitioning II 拆分回文串之二
Given a string s, partition s such that every substring of the partition is a
palindrome
.
·
2015-02-04 05:00
partition
LeetCode 9.
Palindrome
Number
题目:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.判断一个整形数字是不是回文。附加条件是不能用额外空间。
caishenfans
·
2015-02-03 15:00
Math
[LeetCode]
Palindrome
Partitioning 拆分回文串
nbsp; Given a string s, partition s such that every substring of the partition is a
palindrome
·
2015-02-03 14:00
partition
POJ 1159
Palindrome
(滚动数组)
链接:clickhere题意:给你一串字符串,让你求最少加入几个字符,才能使得这个字符串是个回文串。思路:设a[i]是这个字符串,b[i]是这个字符串的逆序串。那么a[i],b[i]的最长公共子序列就是所求的字符串里拥有的最大的回文串。然后用总串长减去最大的回文串长度即为所求。求最长公共子序列的公式为:dp[i][j]=max(dp[i-1][j],dp[i][j-1])if(a[i]==b[i]
u013050857
·
2015-01-31 21:00
字符串
ACM
滚动数组
总结之字符串
1.Valid
Palindrome
http://blog.csdn.net/chencheng126/article/details/395229432.ImplementstrStr()http://
chencheng126
·
2015-01-30 16:00
UVa 401 -
Palindrome
s
哇靠,拼到现在也不容易了,这道水题wa了3遍才过,这都是教训啊!!! 不过有长进的是用上了上次的教训:常量数组的使用。本题出的问题主要有:对数组b进行赋值时没有对其结束位置加'\0',习惯不好;对镜像串的理解出现差错; 审题时没有注意每组数据之后有一个空格,因此wa了一次,太不值了!。继续来吧!!!#include#include#includechard1[]="AEHIJLMOSTUVWXYZ
ft_sunshine
·
2015-01-30 03:00
UVA 10617 Again
Palindrome
s (区间dp)
题意:给你n个串(最长不超过60),问有多少种删去字符的方法使剩下的字符成为一个回文子串。解析:设dp[l][r]为从l到r有多少个回文串。当str[l]!=str[r]时,我们要考虑(l+1,r)组成的回文串,(l,r-1)之间的回文串,但是两者都会计算(x+1,y-1)的回文串数,所以要减去(x+1,y-1)的回文串数,dp[l][r]=dp[l+1][r]+dp[l][r-1]-dp[l+1
HelloWorld10086
·
2015-01-29 17:00
uva
10617
UVA 10739 String to
Palindrome
(区间dp)
题意:为给出一个字符串,现在可以进行3种操作(添加字母,删除字母,替换字母),将其变成回文串,求出最少的操作次数。解析:用d[i][j]表示将第i到j之间的字串变成回文串的最小操作步数,然后转移方程为当s[i]!=s[j]时,dp[i][j]=min(dp[i][j],d[i][j-1],d[i+1][j-1])+1;当s[i]==s[j]时,dp[i][j]=d[i+1][j-1];解释一下情况
HelloWorld10086
·
2015-01-29 17:00
uva
10739
LeetCode-
Palindrome
Number
题目Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.这种回文类型的题目以前都是做过的,比如字符串是否回文,一般的算法如下:publicbooleanis
Palindrome
My_Jobs
·
2015-01-29 12:00
leetcode.9---------------
Palindrome
Number
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.clicktoshowspoilers.Somehints:Couldnegativeintegersbe
palindrome
s
chenxun2009
·
2015-01-29 10:00
LeetCode
算法
ACM
number
palindrome
LeetCode 234 -
Palindrome
Linked List
Given a singly linked list of characters, write a function that returns true if the given list is
palindrome
yuanhsh
·
2015-01-29 08:00
LeetCode
LeetCode 234 -
Palindrome
Linked List
Given a singly linked list of characters, write a function that returns true if the given list is
palindrome
yuanhsh
·
2015-01-29 08:00
LeetCode
Palindrome
Number
题目链接:
Palindrome
NumberDeterminewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbe
palindrome
s
makuiyu
·
2015-01-28 19:00
LeetCode
C++
数学
leetcode_9_
Palindrome
Number
描述:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.clicktoshowspoilers.Somehints:Couldnegativeintegersbe
palindrome
s
dfb198998
·
2015-01-28 08:00
number
StringBuilder
palindrome
Palindrome
Number Leetcode Python
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.clicktoshowspoilers.Somehints:Couldnegativeintegersbe
palindrome
s
hyperbolechi
·
2015-01-28 05:00
LeetCode
python
LeetCode125——Valid
Palindrome
Givenastring,determineifitisa
palindrome
,consideringonlyalphanumericcharactersandignoringcases.Forexample
booirror
·
2015-01-27 18:00
LeetCode
C++
LeetCode9——
Palindrome
Number
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.题目大意判断一个int是否为回文数,不使用额外的储存空间。
booirror
·
2015-01-27 10:00
LeetCode
C++
回文
[C++]LeetCode: 121
Palindrome
Partitioning (分割回文子串 回溯法)
题目:Givenastring s,partition s suchthateverysubstringofthepartitionisa
palindrome
.Returnallpossible
palindrome
partitioningof
cinderella_niu
·
2015-01-25 15:00
LeetCode
backtracking
上一页
81
82
83
84
85
86
87
88
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他