#leetCode

leetcode 211. Add and Search Word

Designadatastructurethatsupportsthefollowingtwooperations:voidaddWord(word)boolsearch(word)search(word)cansearchaliteralwordoraregularexpressionstringcontaining...

leetcode 349. Intersection of Two Arrays

Giventwoarrays,writeafunctiontocomputetheirintersection.Example:Given nums1 = [1,2,2,1], nums2 = [2,2],return [2].Note:Eachel...

leetcode 659. Split Array into Consecutive Subsequences

Youaregivenanintegerarraysortedinascendingorder(maycontainduplicates),youneedtosplitthemintoseveralsubsequences,whereeachsubsequencesconsistofatleast3consecutiv...

leetcode 658. Find K Closest Elements

Givenasortedarray,twointegers k and x,findthe k closestelementsto x inthearray.Theresultshouldalsobesortedinascendingorder.If...

leetcode 657. Judge Route Circle

  Initially,thereisaRobotatposition(0,0).Givenasequenceofitsmoves,judgeifthisrobotmakesacircle,whichmeansitmovesbackto theoriginalplace.Themovese...

leetcode 179. Largest Number

Givenalistofnonnegativeintegers,arrangethemsuchthattheyformthelargestnumber.Forexample,given [3,30,34,5,9],thelargestformednumberis 9534330.Note:There...
代码星球 ·2021-01-23

leetcode 660. Remove 9

Startfrominteger1,removeanyintegerthatcontains9suchas9,19,29...Sonow,youwillhaveanewintegersequence:1,2,3,4,5,6,7,8,10,11,...Givenapositiveinteger n,younee...
代码星球 ·2021-01-23

leetcode 442. Find All Duplicates in an Array

Givenanarrayofintegers,1≤a[i]≤ n (n =sizeofarray),someelementsappear twice andothersappear once.Findalltheelementsthatappear ...

leetcode 405. Convert a Number to Hexadecimal

Givenaninteger,writeanalgorithmtoconvertittohexadecimal.Fornegativeinteger, two’scomplement methodisused.Note:Alllettersinhexadecimal(a-f)mustbeinlowe...

leetcode 506. Relative Ranks

Givenscoresof N athletes,findtheirrelativeranksandthepeoplewiththetopthreehighestscores,whowillbeawardedmedals:"GoldMedal","SilverMedal"and"BronzeMeda...
代码星球 ·2021-01-23

leetcode 316. Remove Duplicate Letters

Givenastringwhichcontainsonlylowercaseletters,removeduplicateletterssothateveryletterappearonceandonlyonce.Youmustmakesureyourresultisthesmallestinlexicographic...

leetcode 654. Maximum Binary Tree

Givenanintegerarraywithnoduplicates.Amaximumtreebuildingonthisarrayisdefinedasfollow:Therootisthemaximumnumberinthearray.Theleftsubtreeisthemaximumtreeconstruct...

leetcode 653. Two Sum IV

GivenaBinarySearchTreeandatargetnumber,returntrueifthereexisttwoelementsintheBSTsuchthattheirsumisequaltothegiventarget.Example1:Input:5/36/247Target=9Output:Tr...
代码星球 ·2021-01-23

leetcode 656. Coin Path

Givenanarray A (indexstartsat 1)consistingofNintegers:A1,A2,...,AN andaninteger B.Theinteger B denotesthatfromanyplace(suppos...
代码星球 ·2021-01-23

leetcode 258. Add Digits

Givenanon-negativeinteger num,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Given num=38,theprocessislike: 3+8=11, 1+1=2...
代码星球 ·2021-01-23
首页上一页...1314151617...下一页尾页