当前位置:首页 » leetcode

leetcode

4
阅读

LeetCode 435. Non-overlapping Intervals

题目:给定一个区间数组,求可以去掉的使得剩余区间不重叠的最少区间数目。Givenacollectionofintervals,findtheminimumnumberofintervalsyouneedtoremovetomaketherestof...
来源 2016-11-17 18:05
5
阅读

leetcode_[python/C++逐步深入] 43. Multiply Strings_(大数乘法分析)

题目链接【题目】Giventwonumbersrepresentedasstrings,returnmultiplicationofthenumbersasastring.Note:Thenumberscanbearbitrarilylargeandarenon-negative.Converting...
来源 2016-11-17 00:32
1
阅读

Leetcode 321. Create Maximum Number[hard]

题目:Giventwoarraysoflengthmandnwithdigits0-9representingtwonumbers.Createthemaximumnumberoflengthk=m+nfromdigitsofthetwo.Therelativeorderofthedigitsfromthesa...
来源 2016-11-16 23:31
2
阅读

Leetcode 330. Patching Array[hard]

题目:Givenasortedpositiveintegerarraynumsandanintegern,add/patchelementstothearraysuchthatanynumberinrange[1,n]inclusivecanbeformedbythesumofsomeelementsinthe...
来源 2016-11-16 17:42
2
阅读

Leetcode 435. Non-overlapping Intervals[medium]

题目:Givenacollectionofintervals,findtheminimumnumberofintervalsyouneedtoremovetomaketherestoftheintervalsnon-overlapping.Note:Youmayassumetheinterval’sendpo...
来源 2016-11-16 16:47
2
阅读

Leetcode 452. Minimum Number of Arrows to Burst Balloons[medium]

题目:hereareanumberofsphericalballoonsspreadintwo-dimensionalspace.Foreachballoon,providedinputisthestartandendcoordinatesofthehorizontaldiameter.Sinceit’sho...
来源 2016-11-16 15:47
2
阅读

Leetcode 455. Assign Cookies[easy]

题目:Assumeyouareanawesomeparentandwanttogiveyourchildrensomecookies.But,youshouldgiveeachchildatmostonecookie.Eachchildihasagreedfactorgi,whichistheminimumsi...
来源 2016-11-16 15:00
2
阅读

leetcode_[python/C++逐步深入]_217. Contains Duplicate(深度分析位操作算法)

题目链接【题目】Givenanarrayofintegers,findifthearraycontainsanyduplicates.Yourfunctionshouldreturntrueifanyvalueappearsatleasttwiceinthearray,anditshouldretur...
来源 2016-11-16 14:23
2
阅读

347.+Top+K+Frequent+Elements(找出数组中出现次数最多的前k个元素)

Givenanon-emptyarrayofintegers,returnthekmostfrequentelements.Forexample,Given[1,1,1,2,2,3]andk=2,return[1,2].Note:Youmayassumekisalwaysvalid,1≤k≤numberofuni...
来源 2016-11-16 11:28
1
阅读

LeetCode 45. Jump Game II

题目Givenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Yo...
来源 2016-11-16 10:52
4
阅读

leetcode_[python/C++] 329. Longest Increasing Path in a Matrix(DFS+记忆化搜索)

题目链接【题目】Givenanintegermatrix,findthelengthofthelongestincreasingpath.Fromeachcell,youcaneithermovetofourdirections:left,right,upordown.YoumayNOTmovedia...
来源 2016-11-16 01:15
2
阅读

LeetCode 44. Wildcard Matching

[b]题目:字符串匹配问题[/b]Implementwildcardpatternmatchingwithsupportfor‘?’and‘*’.‘?’Matchesanysinglecharacter.‘*’Matchesanysequenceofcharacters(inclu...
来源 2016-11-16 00:17
7
阅读

leetcode_[python/C++] 179. Largest Number(数字组合成最大数)

题目链接【题目】Givenalistofnonnegativeintegers,arrangethemsuchthattheyformthelargestnumber.Forexample,given[3,30,34,5,9],thelargestformednumberis9534330.Note:...
来源 2016-11-15 18:06
5
阅读

leetcode_[python/C++] 17.Letter Combinations of a Phone Number(手机号码字符组合)

题目链接【题目】Givenadigitstring,returnallpossiblelettercombinationsthatthenumbercouldrepresent.Amappingofdigittoletters(justlikeonthetelephonebuttons)isgiven...
来源 2016-11-15 17:40
1
阅读

leetcode-4.+Median+of+Two+Sorted+Arrays

leetcode-4.MedianofTwoSortedArraysTherearetwosortedarraysnums1andnums2ofsizemandnrespectively.Findthemedianofthetwosortedarrays.Theoverallruntimecomplexityshou...
来源 2016-11-15 15:27
1
阅读

leetcode-43.+Multiply+Strings

leetcode-43.MultiplyStrings实现原理的话图解简单的说就是根据相乘位置的坐标来计算结果。因为这个只是两个数相乘所以每次相乘只会影响两个位。知道这样的原理只要用类...
来源 2016-11-14 14:20
1
阅读

leetcode-67.+Add+Binary

leetcode-67.AddBinary没什么要说的[code]publicclassSolution{publicStringaddBinary(Stringa,Stringb){Stringsb=;inti=a.length()-1,j=b.length()-1,c=0;for(;i=0&&j=...
来源 2016-11-14 14:16
1
阅读

leetcode-445.+Add+Two+Numbers+II

leetcode-445.AddTwoNumbersII题目:Youaregiventwolinkedlistsrepresentingtwonon-negativenumbers.Themostsignificantdigitcomesfirstandeachoftheirnodescontainasingl...
来源 2016-11-14 14:14
1
阅读

leetcode-2-Add+Two+Numbers

2-AddTwoNumbers题目:Youaregiventwolinkedlistsrepresentingtwonon-negativenumbers.Thedigitsarestoredinreverseorderandeachoftheirnodescontainasingledigit.Addthet...
来源 2016-11-14 14:09
1
阅读

leetcode_[python/C++]_300_Longest Increasing Subsequence

题目链接【题目】Givenanunsortedarrayofintegers,findthelengthoflongestincreasingsubsequence.ForexampleGiven[10,9,2,5,3,7,101,18],Thelongestincreasingsubsequence...
来源 2016-11-13 17:31
2
阅读

leetcode+-+1、15、18、167

1.TwoSum167.TwoSumII-Inputarrayissorted其实我没太看出来这两道题到底有什么区别,似乎按照出题人的考虑第一道题用hashmap来做比较好,后面一道题用两点法来做比较好。...
来源 2016-11-13 14:31
7
阅读

leetcode_[python/C++]_395_Longest Substring with At Least K Repeating Characters_(递归非递归)

题目链接【题目】FindthelengthofthelongestsubstringTofagivenstring(consistsoflowercaselettersonly)suchthateverycharacterinTappearsnolessthanktimes.Example1:Inpu...
来源 2016-11-13 11:35
7
阅读

leetcode_[python/C++]_395_Longest Substring with At Least K Repeating Characters

题目链接【题目】FindthelengthofthelongestsubstringTofagivenstring(consistsoflowercaselettersonly)suchthateverycharacterinTappearsnolessthanktimes.Example1:Inpu...
来源 2016-11-13 11:05
1
阅读

LeetCode #110 - Balanced Binary Tree - Easy

Problem[code]Givenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesofev...
来源 2016-11-12 22:04
1
阅读

LeetCode #101 - Symmetric Tree - Easy

Problem[code]Givenabinarytree,checkwhetheritisamirrorofitself(ie,symmetricarounditscenter).Example[code]thisbinarytree[1,2,2,3,4,4,3]issymmetric:1/\22/\/\3443B...
来源 2016-11-12 22:02