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
leet
Leet
Code OJ 21. Merge Two Sorted Lists [Difficulty: Easy]
题目:Mergetwosortedlinkedlistsandreturnitasanewlist.Thenewlistshouldbemadebysplicingtogetherthenodesofthefirsttwolists.翻译:合并2个已经排序的链表,并且返回一个新的链表。这个新的链表应该由前面提到的2个链表的节点所组成。分析:注意头节点的处理,和链表结束(next为null)的处理。
Lnho2015
·
2016-03-04 13:00
算法
链表
Leet
Code OJ 206. Reverse Linked List [Difficulty: Easy]
题目:Reverseasinglylinkedlist.Hint:Alinkedlistcanbereversedeitheriterativelyorrecursively.Couldyouimplementboth?翻译:反转一个单链表。分析:可以先尝试通过简单例子画图分析,来弄清如何修改指向。代码:/***Definitionforsingly-linkedlist.*publicclass
Lnho2015
·
2016-03-03 20:00
LeetCode
算法
单链表
Leet
Code OJ 7. Reverse Integer [Difficulty: Easy]
题目:Reversedigitsofaninteger.Example1:x=123,return321Example2:x=-123,return-321Haveyouthoughtaboutthis?Herearesomegoodquestionstoaskbeforecoding.Bonuspointsforyouifyouhavealreadythoughtthroughthis!Ifth
Lnho2015
·
2016-03-03 16:00
LeetCode
算法
溢出
Leet
Code OJ 38. Count and Say [Difficulty: Easy]
题目:Thecount-and-saysequenceisthesequenceofintegersbeginningasfollows:1,11,21,1211,111221,…1isreadoffas“one1”or11.11isreadoffas“two1s”or21.21isreadoffas“one2,thenone1”or1211.Givenanintegern,generatethe
Lnho2015
·
2016-03-03 13:00
算法
Leet
Code OJ 38. Count and Say [Difficulty: Easy]
题目:Thecount-and-saysequenceisthesequenceofintegersbeginningasfollows:1,11,21,1211,111221,…1isreadoffas“one1”or11.11isreadoffas“two1s”or21.21isreadoffas“one2,thenone1”or1211.Givenanintegern,generatethe
Lnho2015
·
2016-03-03 13:00
算法
Leet
Code OJ 168. Excel Sheet Column Title [Difficulty: Easy]
题目:Givenapositiveinteger,returnitscorrespondingcolumntitleasappearinanExcelsheet.Forexample:1->A 2->B 3->C ... 26->Z 27->AA 28->AB 翻译:给定一个正数,返回它类似Excle中对应的列标题。分析:关联问题:“ExcelSheetColumnNumber”实际为10进制转2
Lnho2015
·
2016-03-03 13:00
算法
Excel
Leet
Code OJ 168. Excel Sheet Column Title [Difficulty: Easy]
题目:Givenapositiveinteger,returnitscorrespondingcolumntitleasappearinanExcelsheet.Forexample:1->A 2->B 3->C ... 26->Z 27->AA 28->AB 翻译:给定一个正数,返回它类似Excle中对应的列标题。分析:关联问题:“ExcelSheetColumnNumber”实际为10进制转2
Lnho2015
·
2016-03-03 13:00
算法
Excel
Leet
Code OJ 171. Excel Sheet Column Number [Difficulty: Easy]
题目:RelatedtoquestionExcelSheetColumnTitleGivenacolumntitleasappearinanExcelsheet,returnitscorrespondingcolumnnumber.Forexample:A->1 B->2 C->3 ... Z->26 AA->27 AB->28 翻译:关联问题:“ExcelSheetColumnTitle”给定一
Lnho2015
·
2016-03-03 12:00
算法
Excel
Leet
Code OJ 171. Excel Sheet Column Number [Difficulty: Easy]
题目:RelatedtoquestionExcelSheetColumnTitleGivenacolumntitleasappearinanExcelsheet,returnitscorrespondingcolumnnumber.Forexample:A->1 B->2 C->3 ... Z->26 AA->27 AB->28 翻译:关联问题:“ExcelSheetColumnTitle”给定一
Lnho2015
·
2016-03-03 12:00
算法
Excel
Leet
Code OJ 237. Delete Node in a Linked List [Difficulty: Easy]
题目:Writeafunctiontodeleteanode(exceptthetail)inasinglylinkedlist,givenonlyaccesstothatnode.Supposedthelinkedlistis1->2->3->4andyouaregiventhethirdnodewithvalue3,thelinkedlistshouldbecome1->2->4afterca
Lnho2015
·
2016-03-02 11:00
算法
Leet
Code OJ 237. Delete Node in a Linked List [Difficulty: Easy]
题目:Writeafunctiontodeleteanode(exceptthetail)inasinglylinkedlist,givenonlyaccesstothatnode.Supposedthelinkedlistis1->2->3->4andyouaregiventhethirdnodewithvalue3,thelinkedlistshouldbecome1->2->4afterca
Lnho2015
·
2016-03-02 11:00
算法
Leet
Code OJ 112. Path Sum [Difficulty: Easy]
题目:Givenabinarytreeandasum,determineifthetreehasaroot-to-leafpathsuchthataddingupallthevaluesalongthepathequalsthegivensum.Forexample:Giventhebelowbinarytreeandsum=22,returntrue,asthereexistaroot-to-l
Lnho2015
·
2016-02-29 19:00
算法
Leet
Code OJ 101. Symmetric Tree [Difficulty: Easy]
题目:Givenabinarytree,checkwhetheritisamirrorofitself(ie,symmetricarounditscenter).Forexample,thisbinarytreeissymmetric:Butthefollowingisnot:Note:Bonuspointsifyoucouldsolveitbothrecursivelyanditerativel
Lnho2015
·
2016-02-29 17:00
算法
Leet
Code OJ 202. Happy Number [Difficulty: Easy]
题目:Writeanalgorithmtodetermineifanumberis“happy”.Ahappynumberisanumberdefinedbythefollowingprocess:Startingwithanypositiveinteger,replacethenumberbythesumofthesquaresofitsdigits,andrepeattheprocessunt
Lnho2015
·
2016-02-27 18:00
LeetCode
算法
Leet
Code OJ 202. Happy Number [Difficulty: Easy]
题目:Writeanalgorithmtodetermineifanumberis“happy”.Ahappynumberisanumberdefinedbythefollowingprocess:Startingwithanypositiveinteger,replacethenumberbythesumofthesquaresofitsdigits,andrepeattheprocessunt
Lnho2015
·
2016-02-27 18:00
LeetCode
算法
Leet
Code OJ 70. Climbing Stairs [Difficulty: Easy]
题目:Youareclimbingastaircase.Ittakesnstepstoreachtothetop.Eachtimeyoucaneitherclimb1or2steps.Inhowmanydistinctwayscanyouclimbtothetop?翻译:你在爬一个楼梯。到达顶部有n级阶梯。每次你可以选择爬一级或者二级。在多少不同的方式去到达顶部?分析:当n=1,无疑只有一种方式,
Lnho2015
·
2016-02-27 17:00
LeetCode
算法
斐波那契数列
Leet
Code OJ 70. Climbing Stairs [Difficulty: Easy]
题目:Youareclimbingastaircase.Ittakesnstepstoreachtothetop.Eachtimeyoucaneitherclimb1or2steps.Inhowmanydistinctwayscanyouclimbtothetop?翻译:你在爬一个楼梯。到达顶部有n级阶梯。每次你可以选择爬一级或者二级。在多少不同的方式去到达顶部?分析:当n=1,无疑只有一种方式,
Lnho2015
·
2016-02-27 17:00
LeetCode
算法
斐波那契数列
Leet
Code OJ 100. Same Tree [Difficulty: Easy]
题目:Giventwobinarytrees,writeafunctiontocheckiftheyareequalornot.Twobinarytreesareconsideredequaliftheyarestructurallyidenticalandthenodeshavethesamevalue.翻译:给2个二叉树,写一个程序去检验它们是否“相同”。如果2个二叉树的结构相同,并且它们的节
Lnho2015
·
2016-02-27 17:00
LeetCode
算法
二叉树
Leet
Code OJ 100. Same Tree [Difficulty: Easy]
题目:Giventwobinarytrees,writeafunctiontocheckiftheyareequalornot.Twobinarytreesareconsideredequaliftheyarestructurallyidenticalandthenodeshavethesamevalue.翻译:给2个二叉树,写一个程序去检验它们是否“相同”。如果2个二叉树的结构相同,并且它们的节
Lnho2015
·
2016-02-27 17:00
LeetCode
算法
二叉树
Leet
Code OJ 263. Ugly Number [Difficulty: Easy]
题目:Writeaprogramtocheckwhetheragivennumberisanuglynumber.Uglynumbersarepositivenumberswhoseprimefactorsonlyinclude2,3,5.Forexample,6,8areuglywhile14isnotuglysinceitincludesanotherprimefactor7.Notethat
Lnho2015
·
2016-02-27 17:00
算法
Leet
Code OJ 263. Ugly Number [Difficulty: Easy]
题目:Writeaprogramtocheckwhetheragivennumberisanuglynumber.Uglynumbersarepositivenumberswhoseprimefactorsonlyinclude2,3,5.Forexample,6,8areuglywhile14isnotuglysinceitincludesanotherprimefactor7.Notethat
Lnho2015
·
2016-02-27 17:00
算法
Leet
Code OJ 169. Majority Element [Difficulty: Easy]
题目:Givenanarrayofsizen,findthemajorityelement.Themajorityelementistheelementthatappearsmorethan⌊n/2⌋times.Youmayassumethatthearrayisnon-emptyandthemajorityelementalwaysexistinthearray.思路分析:题意是给定一个长度为n
Lnho2015
·
2016-02-26 18:00
算法
Leet
Code OJ 217. Contains Duplicate [Difficulty: Easy]
题目:Givenanarrayofintegers,findifthearraycontainsanyduplicates.Yourfunctionshouldreturntrueifanyvalueappearsatleasttwiceinthearray,anditshouldreturnfalseifeveryelementisdistinct.思路分析:题意是给定一个整形数组,如果里面的元
Lnho2015
·
2016-02-26 18:00
算法
Leet
Code OJ 283. Move Zeroes [Difficulty: Easy]
题目:Givenanarraynums,writeafunctiontomoveall0’stotheendofitwhilemaintainingtherelativeorderofthenon-zeroelements.Forexample,givennums=[0,1,0,3,12],aftercallingyourfunction,numsshouldbe[1,3,12,0,0].Note
Lnho2015
·
2016-02-26 14:00
算法
Leet
Code OJ 226. Invert Binary Tree [Difficulty: Easy]
题目:Invertabinarytree.4/\27/\/\1369to4/\72/\/\9631思路分析:题意是将二叉树所有左右子数对调,如上图所示。具体做法是,先递归处理左右子树,然后将当前的左右子树对调。代码实现:/** *Definitionforabinarytreenode. *publicclassTreeNode{ *intval; *TreeNodeleft; *TreeNode
Lnho2015
·
2016-02-26 14:00
Leet
Code OJ 104. Maximum Depth of Binary Tree [Difficulty: Easy]
题目:Givenabinarytree,finditsmaximumdepth.Themaximumdepthisthenumberofnodesalongthelongestpathfromtherootnodedowntothefarthestleafnode.代码实现:/***Definitionforabinarytreenode.*publicclassTreeNode{*intval;
Lnho2015
·
2016-02-26 14:00
算法
Leet
Code OJ 258. Add Digits [Difficulty: Easy]
题目:Givenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Givennum=38,theprocessislike:3+8=11,1+1=2.Since2hasonlyonedigit,returnit.Followup:Couldyoudoitwithouta
Lnho2015
·
2016-02-26 14:00
Leet
Code OJ 231. Power of Two [Difficulty: Easy]
题目:Givenaninteger,writeafunctiontodetermineifitisapoweroftwo.分析:题意是给定一个整数,判断它是不是2的幂。代码实现:publicclassSolution{ publicbooleanisPowerOfTwo(intn){ if(n<1){ returnfalse; } if(n==1){ returntrue; } if((n&1)=
Lnho2015
·
2016-02-26 13:00
算法
Leet
Code OJ 242. Valid Anagram [Difficulty: Easy]
题目:Giventwostringssandt,writeafunctiontodetermineiftisananagramofs.Forexample,s=“anagram”,t=“nagaram”,returntrue.s=“rat”,t=“car”,returnfalse.Note:Youmayassumethestringcontainsonlylowercasealphabets.Fo
Lnho2015
·
2016-02-26 12:00
算法
Leet
Code OJ 292. Nim Game [Difficulty: Easy]
题目:YouareplayingthefollowingNimGamewithyourfriend:Thereisaheapofstonesonthetable,eachtimeoneofyoutaketurnstoremove1to3stones.Theonewhoremovesthelaststonewillbethewinner.Youwilltakethefirstturntoremove
Lnho2015
·
2016-02-26 12:00
游戏
算法
Leet
Code OJ 136. Single Number [Difficulty: Medium]
题目:Givenanarrayofintegers,everyelementappearstwiceexceptforone.Findthatsingleone.Note:Youralgorithmshouldhavealinearruntimecomplexity.Couldyouimplementitwithoutusingextramemory?分析:题意是给定一个数组,该数组除了一个元素只
Lnho2015
·
2016-02-26 11:00
算法
leetcode Increasing Triplet Subsequence
leetcodeIncreasingTripletSubsequenceGivenanunsortedarrayreturnwhetheranincreasingsubsequenceoflength3existsornotinthearray.Formallythefunctionshould:Returntrueifthereexists i,j,k suchthat arr[i]
leet
murmured
·
2016-02-16 14:00
Word Break
determineifscanbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens="leetcode",dict=["
leet
KickCode
·
2016-02-14 12:08
动态规划
leet
_14 Longest Common Prefix
packagecom.mingxin.leetcode.
leet
_14; /** *CreatedbyAdministratoron2016/1/25. */ publicclassLongestCommonPrefix
狂暴的小学生
·
2016-01-26 10:00
leet
_15
Givenanarray S of n integers,arethereelements a, b, c in S suchthat a + b + c =0?Findalluniquetripletsinthearraywhichgivesthesumofzero.Note:Elementsinatriplet(a,b,c)mustbeinnon-descendingorder.(ie, a
狂暴的小学生
·
2016-01-26 10:00
leet
_11
题目:https://leetcode.com/problems/container-with-most-water/Given n non-negativeintegers a1, a2,..., an,whereeachrepresentsapointatcoordinate(i, ai). n verticallinesaredrawnsuchthatthetwoendpointsoflin
狂暴的小学生
·
2016-01-26 10:00
leetcode笔记:Word Break
determineifscanbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens="leetcode",dict=["
leet
liyuefeilong
·
2016-01-25 23:00
LeetCode
Algorithm
C++
算法
String
Leetcode题解——Word Break
canbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens = "leetcode",dict = ["
leet
u010025211
·
2016-01-06 17:00
LeetCode
dp
recursive
Leet
题目整理归类 - 快速通道 (持续更新)
刷
Leet
5个月了,先总结一下,这里算是每题的快速通道。自己做个记录便于以后重温算法。如果能帮到别人就更好了。本人是算法新手,如果对于一些题目读者有更好的实现方法,如能不吝赐教,万分感谢。
csharp25
·
2015-12-02 17:00
LeetCode --Word Break
determineifscanbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens="leetcode",dict=["
leet
csharp25
·
2015-12-02 10:00
【LEETCODE】219-Contains Duplicate II
findoutwhethertherearetwodistinctindicesiandjinthearraysuchthatnums[i]=nums[j]andthedifferencebetweeniandjisatmostk.参考:http://bookshadow.com/weblog/2015/05/29/
leet
aliceyangxi1987
·
2015-11-27 15:00
LeetCode
python
【leetcode】Word Break(java)
canbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens = "leetcode",dict = ["
leet
过客航
·
2015-11-19 16:00
java
LeetCode
leetcode Word Break-单词划分
例如s = “leetcode” ,dict = {“
leet
”,“code”},那么s可以由dict中的单词组成。
·
2015-11-13 14:42
LeetCode
leetcode[139] Word Break
例如: For example, givens = "leetcode",dict = ["
leet
", "
·
2015-11-13 12:42
LeetCode
总结一下Word Break I 和 II
determineifscanbesegmentedintoaspace-separatedsequenceofoneormoredictionarywords.Forexample,givens="leetcode",dict=["
leet
u011029779
·
2015-11-12 06:00
Algorithm
LeetCode
面试题
[leetcode]Word Break
但是如果自底向上求的话会计算很多不需要的,比如
leet
已经在字典里了,很多情况下就不需要计算下面的l,e,e,t了,所以自顶向下递归+备忘录会是更
·
2015-11-11 09:12
LeetCode
[itint5]合并K个有序链表
merge sort,
leet
code里面曾经做过。但一开始没这么写,遍历来做,效率n*k了,用了merge sort后,变成logn*k。 用了dummy node。
·
2015-11-10 21:17
int
Python标准库——一日一库
printsprintstring.capwords(s,None)
leet
=string.maketrans('abcdefg','1234567')printsprints.translate(
leet
duzhuqi
·
2015-11-08 22:37
Python
Leet
Palindrome Partitioning II
1 class Solution { 2 public: 3 int minCut(string s) { 4 int len = s.length(); 5 int* p_dp = new int[len + 1]; 6 char* s_dp = new char[len * len]; 7 in
·
2015-11-02 19:09
partition
java工程开发之图形化界面之(第二课)
例如:public static final int Y_
LEET
_EYE = Y_R
·
2015-10-31 09:43
java
上一页
9
10
11
12
13
14
15
16
下一页
按字母分类:
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
其他