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
Leetcode题解
LeetCode题解
:Anagrams
AnagramsGivenanarrayofstrings,returnallgroupsofstringsthatareanagrams.Note:Allinputswillbeinlower-case.思路:关键在于对题目的理解。本文中anagrams指只有字母排列顺序不同的单词,例如eat,ate,tea。倘若有多组anagrams,那么返回所有的anagrams。两个空字符串也算一对ana
MagiSu
·
2013-10-26 15:00
LeetCode
LeetCode题解
:Count and Say
CountandSayThecount-and-saysequenceisthesequenceofintegersbeginningasfollows:1,11,21,1211,111221,...1isreadoffas"one1"or11.11isreadoffas"two1s"or21.21isreadoffas"one2,thenone1"or1211.Givenanintegern,g
MagiSu
·
2013-10-26 13:00
LeetCode
LeetCode题解
:Subsets I and II
SubsetsGivenasetofdistinctintegers,S,returnallpossiblesubsets.Note:Elementsinasubsetmustbeinnon-descendingorder.Thesolutionsetmustnotcontainduplicatesubsets.Forexample,IfS=[1,2,3],asolutionis:[ [3], [
MagiSu
·
2013-10-24 04:00
LeetCode
LeetCode题解
:Merge Sorted Array
MergeSortedArrayGiventwosortedintegerarraysAandB,mergeBintoAasonesortedarray.Note:YoumayassumethatAhasenoughspacetoholdadditionalelementsfromB.ThenumberofelementsinitializedinAandBaremandnrespectively
MagiSu
·
2013-10-24 04:00
LeetCode
LeetCode题解
:Pow(x,n)
Pow(x,n)Implementpow(x,n).思路:1.直接循环求解,最简单的方法2.分而治之,可以减少一半的乘法。3.如果n可能是浮点数的话,要考虑用对数运算。题解:classSolution{ public: doublepow_proc(doublex,intn){ doublep; switch(n) { case0: return1; case1: returnx; default
MagiSu
·
2013-10-22 11:00
LeetCode
LeetCode题解
:Valid Parentheses
ValidParenthesesGivenastringcontainingjustthecharacters'(',')','{','}','['and']',determineiftheinputstringisvalid.Thebracketsmustcloseinthecorrectorder,"()"and"()[]{}"areallvalidbut"(]"and"([)]"arenot
MagiSu
·
2013-10-22 11:00
LeetCode
LeetCode题解
:Sum Root to Leaf Numbers
SumRoottoLeafNumbersGivenabinarytreecontainingdigitsfrom0-9only,eachroot-to-leafpathcouldrepresentanumber.Anexampleistheroot-to-leafpath1->2->3whichrepresentsthenumber123.Findthetotalsumofallroot-to-l
MagiSu
·
2013-10-22 11:00
LeetCode
LeetCode题解
:Jump Game
JumpGameGivenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Determineifyouareabletoreachthelastinde
MagiSu
·
2013-10-21 00:00
LeetCode
LeetCode题解
:Balanced Binary Tree
BalancedBinaryTreeGivenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesofeverynodeneverdifferbymorethan1.思路:二叉树
MagiSu
·
2013-10-20 07:00
LeetCode
LeetCode题解
:Merge k Sorted Lists
MergekSortedListsMergeksortedlinkedlistsandreturnitasonesortedlist.Analyzeanddescribeitscomplexity思路:标准的mergesort使用min(x,y),这里需要的是min(x1,x2,...xk),可以用堆实现。题解:/** *Definitionforsingly-linkedlist. *struc
MagiSu
·
2013-10-18 19:00
LeetCode题解
:Length of Last Word
LengthofLastWordGivenastringsconsistsofupper/lower-casealphabetsandemptyspacecharacters'',returnthelengthoflastwordinthestring.Ifthelastworddoesnotexist,return0.Note:Awordisdefinedasacharactersequence
MagiSu
·
2013-10-17 09:00
LeetCode
LeetCode题解
:Two Sum
TwoSumGivenanarrayofintegers,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyadduptothetarget,whereindex1mustbelessthanindex2.Plea
MagiSu
·
2013-10-16 05:00
LeetCode
上一页
25
26
27
28
29
30
31
32
下一页
按字母分类:
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
其他