• 等级
  • 56594 访问
  • 100 原创
  • 343 转发
  • 28786 排名
  • 15 评论
  • 8 获赞

9. Palindrome Number

Determinewhetheranintegerisapalindrome.Aninteger is a palindromewhenit readsthesamebackwardasforward.Example1:Input:121Output:trueExample2:Input:-121Output:falseExpl...

2019-02-22 09:21:41

Bitwise ORs of Subarrays

Wehaveanarray A ofnon-negativeintegers.Forevery(contiguous)subarray B= [A[i],A[i+1],...,A[j]] (with i<=j),wetakethebitwiseORofalltheelementsin B,obtainingaresult A[i]|...

2019-02-21 09:04:01

C++11 lambda使用

lambda是匿名函数,可以拿来当作inline函数使用(用于解决程序员的“起名困难综合症”)lambda函数形式:[...](...)...{...}[]内是一个capture,可以在lambda内部访问的"nonstatic外部变量",如果没有要访问的变量,可以为空。static变量是可以直接被访问的。()内是参数,和函数参数一样。...是mutable,异常明细...

2018-11-15 09:28:49

桶排序,计数排序,基数排序

桶排序:要排序的数据有n个,均匀地划分到m个桶内,每个桶里就有k=n/m个元素。每个桶内部使用快速排序,时间复杂度为O(k*logk)。m个桶排序的时间复杂度是O(m*k*logk),因为k=n/m,所以整个桶排序的时间复杂度就是O(n*log(n/m))。当桶个数m接近数据个数n时,log(n/m)就是一个非常小的常量,这个时候桶排序的时间复杂度接近O(n)。如果有些桶内的数据非常多,有...

2018-10-22 08:29:00

863. All Nodes Distance K in Binary Tree

Wearegivenabinarytree(withrootnode root),a target node,andanintegervalue K.Returnalistofthevaluesofall nodesthathaveadistance K fromthe target node. Theanswercanberetur...

2018-09-28 09:09:17

865. Smallest Subtree with all the Deepest Nodes

Givenabinarytreerootedat root,the depth ofeachnodeistheshortestdistancetotheroot.Anodeis deepest ifithasthelargestdepthpossibleamong anynodeinthe entiretree.Thesubtree...

2018-09-28 08:50:36

877. Stone Game

AlexandLeeplayagamewithpilesofstones. Thereareanevennumberof piles arrangedinarow,andeachpilehasapositiveintegernumberofstones piles[i].Theobjectiveofthegameistoen...

2018-09-17 16:53:37

685. Redundant Connection II

Inthisproblem,arootedtreeisa directed graphsuchthat,thereisexactlyonenode(theroot)forwhichallothernodesaredescendantsofthisnode,pluseverynodehasexactlyoneparent,excep...

2018-09-14 09:26:44

684. Redundant Connection

Inthisproblem,atreeisan undirected graphthatisconnectedandhasnocycles.ThegiveninputisagraphthatstartedasatreewithNnodes(withdistinctvalues1,2,...,N),withoneadditi...

2018-09-13 09:27:58

563. Binary Tree Tilt

Givenabinarytree,returnthetiltofthe wholetree.Thetiltofa treenode isdefinedasthe absolutedifference betweenthesumofallleftsubtreenodevaluesandthesumofallrightsubtree...

2018-09-10 08:42:49

543. Diameter of Binary Tree

Givenabinarytree,youneedtocomputethelengthofthediameterofthetree.Thediameterofabinarytreeisthelengthofthe longest pathbetweenanytwonodesinatree.Thispathmayormayn...

2018-09-10 08:21:28

515. Find Largest Value in Each Tree Row

Youneedtofindthelargestvalueineachrowofabinarytree.Example:Input:1/\32/\\539Output:[1,3,9]/***Definitionf...

2018-09-07 09:06:58

513. Find Bottom Left Tree Value

Givenabinarytree,findtheleftmostvalueinthelastrowofthetree.Example1:Input:2/\13Output:1 Example2: Input:1/\23//\...

2018-09-07 08:55:46

508. Most Frequent Subtree Sum

Giventherootofatree,youareaskedtofindthemostfrequentsubtreesum.Thesubtreesumofanodeisdefinedasthesumofallthenodevaluesformedbythesubtreerootedatthatnode(includi...

2018-09-07 08:44:06

108. Convert Sorted Array to Binary Search Tree

Givenanarraywhereelementsaresortedinascendingorder,convertittoaheightbalancedBST.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthe...

2018-09-06 09:08:48

96. Unique Binary Search Trees

Given n,howmanystructurallyunique BST's (binarysearchtrees)thatstorevalues1... n?Example:Input:3Output:5Explanation:Givenn=3,thereareatotalof5uniqueBST's:1...

2018-09-06 08:44:07

257. Binary Tree Paths

Givenabinarytree,returnallroot-to-leafpaths.Note: Aleafisanodewithnochildren.Example:Input:1/\23\5Output:["1->2->5","1->3"]Explanation:Allroo...

2018-09-06 08:36:15

501. Find Mode in Binary Search Tree

Givenabinarysearchtree(BST)withduplicates,findallthe mode(s) (themostfrequentlyoccurredelement)inthegivenBST.AssumeaBSTisdefinedasfollows:Theleftsubtreeofanodecontain...

2018-09-05 09:28:49

98. Validate Binary Search Tree

Givenabinarytree,determineifitisavalidbinarysearchtree(BST).AssumeaBSTisdefinedasfollows:Theleftsubtreeofanodecontainsonlynodeswithkeys lessthan thenode'skey. The...

2018-09-05 09:08:45

213. House Robber II

Youareaprofessionalrobberplanningtorobhousesalongastreet.Eachhousehasacertainamountofmoneystashed.Allhousesatthisplaceare arrangedinacircle. Thatmeansthefirsthouseis...

2018-09-05 08:58:48

无名_1989

1、每天坚持读书1小时;2、坚持提升专业,成为单位专业权威;3、战胜两个坏毛病——拖延与抱怨;4、先从形象上改变,提升你的自信;5、时常反省自己,但不诋毁自己;6、向优秀的人学习;7、坚持早睡早起;8、坚持体育锻炼;9、保持微笑;10、帮助他人 ​​​​
关注
  • 计算机软件/程序员
  • 中国 北京 海淀区
奖章
  • 专栏达人