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
[LeetCode 214] Shortest
Palindrome
GivenastringS,youareallowedtoconvertittoa
palindrome
byaddingcharactersinfrontofit.Findandreturntheshortest
palindrome
youcanfindbyperformingthistransformation.Forexample
sbitswc
·
2015-10-05 13:00
LeetCode
String
palindrome
Queries for Number of
Palindrome
s(区间dp)
题目链接:codeforces245H题目大意:给出一个字符串,询问任意区间内的回文子串的个数。题目分析:定义isPar[i][j]表示区间字符串[i,j]是否是回文,可以通过isPar[i+1][j-1]递推得到。定义dp[i][j]表示及区间[i,j]内的回文子串的个数,转移方程如下:dp[i][j]=dp[i+1][j]+dp[i][j−1]−dp[i+1][j−1]+isPar[i][j]
qq_24451605
·
2015-10-05 09:00
dp
codeforces
判断一个字符串是不是回文(C#解法)
下面是C#的实现方式:class
Palindrome
{ staticpublicvoid
Palindrome
Main() { System.Console.Write("pleaseentera
palindrome
booirror
·
2015-10-02 21:00
C#
回文
回文字符串
*LeetCode-Longest Palindromic Substring
start是一个static的)然后再用i,i+1开始extend这种就是偶数位的publicclassSolution{ publicintstart,maxLen; publicStringlongest
Palindrome
bsbcarter
·
2015-10-02 05:00
Codeforces 557E Ann and Half-
Palindrome
(Trie树)
题目大意:就是现在给出长度不超过5000的只包含小写字母'a'和‘b'的字符串定义半回文串:字符串S是半回文串的条件是S[i]=S[|S|-i+1]对所有的计数i,i #include #include #include #include #include #include #include #include #include #include #include #include #include
u013738743
·
2015-10-01 21:00
codeforces
Trie树
557E
ACdream 1019
Palindrome
树状数组+Hash
题目大意:就是现在给出一个长度不超过100万的字符串,有两种操作,修改某个位置的字符,询问[L,R]这个部分的字串是否是回文串大致思路:这个题刚开始用线段树写了一发发现MLE...然后就换树状数组了...不知道zkw线段树能不能行首先对于这个串按照原来的顺序和倒序分别建立树状数组,保存每个字符对应在全部的串中对应的哈希值然后树状数组查询区间和,修改的时候单点修改即可整体复杂度O((n+Q)logn
u013738743
·
2015-10-01 21:00
hash
树状数组
palindrome
1019
ACdream
LeetCode 题解(242) :
Palindrome
Permutation II
题目:Givenastrings,returnallthepalindromicpermutations(withoutduplicates)ofit.Returnanemptylistifnopalindromicpermutationcouldbeform.Forexample:Givens="aabb",return["abba","baab"].Givens="abc",return[].
u011029779
·
2015-09-28 04:00
Algorithm
LeetCode
面试题
*LeetCode-
Palindrome
Linked List
翻转firsthalf然后一个从中间向前一个向后进行对比我自己写的把找到中间和翻转写成了两步很多错很麻烦其实可以写到一起publicclassSolution{ publicbooleanis
Palindrome
bsbcarter
·
2015-09-28 00:00
LeetCode 9
Palindrome
Number (回文数)
翻译确定一个整数是否是回文数。不能使用额外的空间。 一些提示: 负数能不能是回文数呢?(比如,-1) 如果你想将整数转换成字符串,但要注意限制使用额外的空间。 你也可以考虑翻转一个整数。 然而,如果你已经解决了问题“翻转整数(译者注:LeetCode第七题), 那么你应该知道翻转的整数可能会造成溢出。 你将如何处理这种情况? 这是一个解决该问题更通用的方法。原文Determinewhet
NoMasp
·
2015-09-27 21:00
LeetCode
字符串
LeetCode 题解(241) :
Palindrome
Permutation
题目:Givenastring,determineifapermutationofthestringcouldforma
palindrome
.Forexample,"code"->False,"aab"
u011029779
·
2015-09-27 12:00
Algorithm
LeetCode
面试题
回文树介绍(Palindromic Tree)
回文树的结构就像线段树、平衡树等其它树结构一样,回文树由若干个节点组成,每个节点代表一个回文串(
palindrome
)。节点例子:四个节点的回文串边节点之间通过有向边连接起来,
lwfcgz
·
2015-09-26 00:00
数据结构
*LeetCode-
Palindrome
Partitioning
和以前的backtracking一样只是需要多了一个check是否是
palindrome
的函数不要被吓倒 publicclassSolution{ publicList>partition(Strings
bsbcarter
·
2015-09-25 23:00
hdu4731Minimum
palindrome
构造
//给出n和m //用m个小写字母,构成长度为n的序列 //这个序列的最长的回文子串长度要最小,如果存在多个 //就输出字典序最小的 //对于三个字母以上的很容易发现是"abcabcabc..." //对于一个字母的很明显 //对于两个字母的小于等于8的需要特判一下 //对于大于8的可以"aababb"一直循环下去,这样的最长回文子串的长度一直是4 //然后就是由于需要字典序最小,所以需要先输出两
cq_pf
·
2015-09-25 22:00
USACO 1.5 Prime
Palindrome
s (打表查询)
(x):-(x)) #definePRECISION1e-2 #defineSIZE779 intnums; intprime
Palindrome
s[SIZE]={5,7,11,101,131,151,181,191,313,353,373,383,727,757
tiutiu2011
·
2015-09-25 21:00
素数
质数
USACO
1.5
Palindromes
Prime
LeetCode----
Palindrome
Linked List
Palindrome
LinkedListGivenasinglylinkedlist,determineifitisa
palindrome
.Followup:CouldyoudoitinO(n)timeandO
whiterbear
·
2015-09-25 19:00
LeetCode
链表
LeetCode:
Palindrome
Number - 回文数
1、题目名称
Palindrome
Number(回文数)2、题目地址https://leetcode.com/problems/
palindrome
-number3、题目内容英文:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace
北风其凉
·
2015-09-24 22:00
LeetCode
回文数
#9
Palindrome
Linked List
【LeetCode】234.
Palindrome
LinkedListGivenasinglylinkedlist,determineifitisa
palindrome
.CouldyoudoitinO(n
zhoujl25
·
2015-09-24 11:00
LeetCode
[LeetCode]
Palindrome
Number & Valid
Palindrome
- 回文系列问题
题目概述:Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.题目分析:判断数字是否是回文例如121、656、3443方法有很多
Eastmount
·
2015-09-24 02:00
LeetCode
数字回文
字符串回文
Longest Palindromic Substring
则有状态转移方程:dp[i][j]=true,if dp[i+1][j-1]==true&&s[i+1]==s[j-1]classSolution{ public: stringlongest
Palindrome
HELLO_THERE
·
2015-09-23 17:00
DP:Cheapest
Palindrome
(POJ 3280)
价值最小回文字符串题目大意:给你一个字符串,可以删除可以添加,并且每一次对一个字母的操作都带一个权,问你转成回文串最优操作数。如果这一题我这样告诉你,你毫无疑问知道这一题是LD(LevenshtienDistance编辑距离),但是上面太多废话了,理解起来还是要有点费劲,比如我一开始就觉得回文串只能从头或者尾添加(英语吃了翔╮(╯▽╰)╭)。好吧,其实这一题不是水题(我的感觉),这一题挺好的,是一
The_Truth
·
2015-09-23 17:00
POJ 1159
Palindrome
(区间dp)
dp[i][j]表示s[i,...,j]至少添加几个字符变成回文,转移方程为if(s[i]==s[j]){ dp[i][j]=dp[i+1][j-1]; } else{ dp[i][j]=min(dp[i+1][j],dp[i][j-1])+1; }注意一下i和j的更新顺序就好了。然后MLE了一下,改为滚动数组就AC了。#pragmawarning(disable:4996) #include #
acraz
·
2015-09-21 16:00
UVA 401
MemoryLimit:0KB 64bitIOFormat:%lld&%lluSubmitStatusPracticeUVA401Appointdescription:DescriptionAregular
palindrome
isastringofnumbersorlettersthatisthesameforwardasbackward.F
became_a_wolf
·
2015-09-21 11:00
leetcode |
Palindrome
Linked List 牛客网 |
Givenasinglylinkedlist,determineifitisa
palindrome
.Followup:CouldyoudoitinO(n)timeandO(1)space?
weizaishouex2010
·
2015-09-19 12:00
LeetCode
牛客网
大白书DP习题
Partitioningby
Palindrome
s第一天~题目传送:UVA-11584-Partitioningby
Palindrome
s分类:DP入门题。
u014355480
·
2015-09-18 23:00
dp
ACM
大白书
uva 11584 动规
usingnamespacestd; constintmaxn=1000+5; intkase,d[maxn],T; boolvis[maxn][maxn],p[maxn][maxn]; stringstr; intis_
palindrome
Tczxw
·
2015-09-18 12:00
[LeetCode] Shortest
Palindrome
最短回文串
GivenastringS,youareallowedtoconvertittoa
palindrome
byaddingcharactersinfrontofit.Findandreturntheshortest
palindrome
youcanfindbyperformingthistransformation.Forexample
lcj_cjfykx
·
2015-09-18 06:00
SPOJ PALIN - The Next
Palindrome
(贪心)
题意:给一个数x(不含前导0),长度不超过1e6,要求找到最小且大于x的数,满足x表示成字符串是一个回文串。比如99->101,808->818,2133->2222解法:要求大于x,不妨先将x=x+1。。要求回文,且最小,不妨设两指针,分别指向需要回文的两个位置,起初t1=0,t2=lens-1,如果s[t1]>=s[t2],说明t2位置不需要进位就可以加到s[t1],使得这两个位置相等,然后t
UESTC_peterpan
·
2015-09-18 05:00
LeetCode 9 判断回文数
x关于中心对称的数字是x%10expi+1/10expi有了这点只需要做好健壮性就能轻易过关PS全体负数不是回文数这点比较坑c#codepublicclassSolution{publicboolIs
Palindrome
AdolPark
·
2015-09-15 20:38
C#
Palindrome
Partitioning II
Givenastring s,partition s suchthateverysubstringofthepartitionisa
palindrome
.Returntheminimumcutsneededfora
palindrome
partitioningof
hcx2013
·
2015-09-15 14:00
Palindrome
pairs( manacher+dp )
题目链接:codeforces159D题目大意:给出一个字符出,求取这个字符串中互相不覆盖的两个回文子串的对数。题目分析:首先能够用manacher模板,因为这个算法处理的字符串的长度式奇数,所以我们首先将原字符串拓展,也就是用一个没有出现过的子串填充到每两个字符之间,首位也要添加,这样处理后得到的字符串一定是奇数长度,对于这个字符串,偶数位上的字符对应原字符串中i/2-1位置上的字符。然后就是利
qq_24451605
·
2015-09-12 21:00
枚举
dp
codeforces
Manacher
Palindrome
Number
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbe
palindrome
s
qdqade
·
2015-09-11 09:01
number
palindrome
Palindrome
Number
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbe
palindrome
s
qdqade
·
2015-09-11 09:01
number
palindrome
Leetcode:
Palindrome
Permutation
QuestionGivenastring,determineifapermutationofthestringcouldforma
palindrome
.Forexample,“code”->False,
ayst123
·
2015-09-11 08:00
USACO 1.2 Dual
PalinDrome
s (递归判断回文)
#include #defineDEBUG0 #defineTESTCASES8 intN,S; voidtransform(intnum,intbase,char*str,int*len){ intquotient=0; inti=0; while((quotient=num/base)!=0){ str[i++]='0'+(num%base); num=quotient; } str[i+
tiutiu2011
·
2015-09-10 14:00
递归
USACO
回文
dual
1.2
Palindromes
【Project Euler】4 第四题
//Apalindromicnumberreadsthesamebothways.Thelargest
palindrome
madefromtheproductoftwo2-digitnumbersis9009
NoMasp
·
2015-09-08 21:00
[LeedCode OJ]#234
Palindrome
Linked List
联系信箱:
[email protected]
】题目链接:https://leetcode.com/problems/
palindrome
-linked-list/题意:给定一个链表,判断这个链表是否回文的
libin1105
·
2015-09-08 19:00
leedcode
[LeetCode-9]
Palindrome
Number(回文数)
Determinewhetheranintegerisa
palindrome
.Dothiswithoutextraspace.Couldnegativeintegersbe
palindrome
s?
xy010902100449
·
2015-09-08 09:00
回文数操作
HDU 2029
Palindrome
s _easy version(水~)
Description“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”Input输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串Output如果一个字符串是回文串,则输出”yes”,否则输出”no”SampleInput4levelabcdenoonhahaSamp
V5ZSQ
·
2015-09-08 08:00
poj3280 Cheapest
Palindrome
DescriptionKeepingtrackofallthecowscanbeatrickytasksoFarmerJohnhasinstalledasystemtoautomateit.HehasinstalledoneachcowanelectronicIDtagthatthesystemwillreadasthecowspassbyascanner.EachIDtag'scontentsa
Kirito_Acmer
·
2015-09-07 19:00
区间DP
Valid
Palindrome
Givenastring,determineifitisa
palindrome
,consideringonlyalphanumericcharactersandignoringcases.Forexample
hcx2013
·
2015-09-07 16:00
poj3280 Cheapest
Palindrome
Cheapest
Palindrome
POJ-3280时限:2000MS内存:65536KB64位IO格式:%I64d&%I64u已开启划词翻译问题描述KeepingtrackofallthecowscanbeatrickytasksoFarmerJohnhasinstalledasystemtoautomateit.HehasinstalledoneachcowanelectronicIDtag
yexiaohhjk
·
2015-09-06 15:00
HDU 4731 Minimum
palindrome
(规律 构造)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4731ProblemDescriptionSettingpasswordisveryimportant,especiallywhenyouhavesomany"interesting"thingsin"F:\TDDOWNLOAD".Wedefinethesafetyofapasswordbyavalue
u012860063
·
2015-09-03 19:00
HDU
规律
构造
LeetCode 9_
Palindrome
Number
今天心情不好,再来写一道吧,只有在编程时才会暂时忘掉不愉快的事,不过希望大家不要被我的情绪干扰。在这里我也祝每个有意或无意看到本文的读者生活幸福,可能文章写得一般,但祝福是真挚的,毕竟每个为自己理想努力的人都是英雄,都有获得幸福的权利。。。肉麻的话就不多说了,进入正题吧。这是leetcode第9题,难度不大,我们简单说一下。原题如下Determinewhetheranintegerisapalin
cyfcsd
·
2015-09-02 22:00
LeetCode
算法
leetcode笔记:Valid
Palindrome
一.题目描述二.解题技巧这道题考察回文数(
palindrome
),这一概念起源于在数学中一类数字,这类数字拥有这样的特征:设n是一任意自然数。
liyuefeilong
·
2015-08-31 13:00
LeetCode
C++
String
palindrome
Leetcode:
Palindrome
Partitioning II
Questionivenastrings,partitionssuchthateverysubstringofthepartitionisa
palindrome
.Returntheminimumcutsneededfora
palindrome
partitioningofs.Forexample
ayst123
·
2015-08-31 10:00
Leetcode:
Palindrome
Partitioning
QuestionGivenastrings,partitionssuchthateverysubstringofthepartitionisa
palindrome
.Returnallpossible
palindrome
partitioningofs.Forexample
ayst123
·
2015-08-31 10:00
HDU 5062 Beautiful
Palindrome
Number——BestCoder Round #13
Beautiful
Palindrome
NumberTimeLimit:3000/1500MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)ProblemDescriptionApositiveintegerxcanrepresentas
queuelovestack
·
2015-08-31 00:00
ACM
【白书之路】401 -
Palindrome
s 回文串 镜像串
palindrome
Aregular
palindrome
isastringofnumbersorlettersthatisthesameforwardasbackward.Forexample,thestring
wr132
·
2015-08-30 21:00
401
Palindromes
回文串
白书之路
镜像串
poj 1159
Palindrome
最长公共子序列 滚动数组
回到寝室之后没事干,也不知道刷什么题目,来道dp试试,其实我dp没怎么学的,还有图论其实也看了个大概,没有前一段看的那么认真。做题一定要保持专注的,认真认真再认真。思路:其实我自己没想出来是最长公共子序列的,这道题目让求的是加进去几个字符能使原来的序列成为回文串,可以求该串和它的逆序串的最长公共子序列,然后用串的总长度减去它就ok啦,如果按模板开int数组的话会超内存,改成short就可以过的,不
sinat_22659021
·
2015-08-30 10:00
Pig and
Palindrome
s 求左上角走到右下角是回文的方法数 DP
题意:给一个n*m的格子,每个格子有一个字母,只有向下和向左两种走法,现在要求,从左上角走到右下角,走过的格子的字母是回文的有多少种走法?DP,枚举步数,因为是回文串,所以应该是对称的,步数应该为(n+m)2向下取整,可以知道,以左上角为起点走,走step步,走到的点是固定的,假设从左上角走到(r1,c1)这个点,并且走了step步,那么明显有r1+c1=step+1(由(1,1)走到(r1,c1
CHCXCHC
·
2015-08-29 16:00
dp
回文数
滚动数组
上一页
74
75
76
77
78
79
80
81
下一页
按字母分类:
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
其他