当前位置:首页 » leetcode

leetcode

1
阅读

leetCode周赛97解题报告 javascript

比赛地址:https://leetcode-cn.com/contest/weekly-contest-97 888.两句话中的不常见单词888.UncommonWordsfromTwoSentences给定两个句子 A 和 B 。 (句子是一串由空格...
来源 2018-08-12 14:22
9
阅读

leetCode周赛96解题报告 javascript

比赛地址:https://leetcode-cn.com/contest/weekly-contest-96 887.ProjectionAreaof3DShapes887.三维形体投影面积在 N * N 的网格中,我们放置了一些与x,y,z三轴对齐...
来源 2018-08-05 12:41
19
阅读

leetCode周赛95解题报告 javascript

比赛地址https://leetcode-cn.com/contest/weekly-contest-95 876.MiddleoftheLinkedList876.链表的中间结点给定一个带有头结点 head 的非空单链表,返回链表的中间结点...
来源 2018-07-29 12:21
5
阅读

leetCode周赛94解题报告 javascript

比赛地址https://leetcode-cn.com/contest/weekly-contest-94 872.Leaf-SimilarTrees考虑一个二叉树的所有叶子。这些叶子的值按从左到右的顺序排列形成一个 叶值序列 。...
来源 2018-07-22 11:42
3
阅读

leetCode周赛93解题报告 javascript

比赛地址https://leetcode-cn.com/contest/weekly-contest-93 868.二进制间距给定一个正整数 N,找到并返回 N 的二进制表示中两个连续的1之间的最长距离。 如果没有两个...
来源 2018-07-15 13:01
11
阅读

leetCode周赛89解题报告 javascript

 比赛地址https://leetcode.com/contest/weekly-contest-89 852.PeakIndexinaMountainArray我们把符合下列属性的数组 A 称作山脉:A.length=3存在 0i A.length-1 使得A[0]...
来源 2018-06-17 12:22
4
阅读

leetcode-104.+Maximum+Depth+of+Binary+Tree

leetcode-104.MaximumDepthofBinaryTree题目:Givenabinarytree,finditsmaximumdepth.Themaximumdepthisthenumberofnodesalongthelongestpathfromtherootnodedowntothefar...
来源 2016-12-27 09:50
4
阅读

leetcode-103.+Binary+Tree+Zigzag+Level+Order+Traversal

leetcode-103.BinaryTreeZigzagLevelOrderTraversal题目:Givenabinarytree,returnthezigzaglevelordertraversalofitsnodes’values.(ie,fromlefttoright,thenrighttoleft...
来源 2016-12-27 09:48
3
阅读

leetcode-102.+Binary+Tree+Level+Order+Traversal

leetcode-102.BinaryTreeLevelOrderTraversal题目:Givenabinarytree,returnthelevelordertraversalofitsnodes’values.(ie,fromlefttoright,levelbylevel).Forexample:Gi...
来源 2016-12-27 09:46
2
阅读

leetcode-101.+Symmetric+Tree

leetcode-101.SymmetricTree题目:Givenabinarytree,checkwhetheritisamirrorofitself(ie,symmetricarounditscenter).Forexample,thisbinarytree[1,2,2,3,4,4,3]issymmetr...
来源 2016-12-26 10:13
2
阅读

leetcode-100.+Same+Tree

leetcode-100.SameTree题目:Giventwobinarytrees,writeafunctiontocheckiftheyareequalornot.Twobinarytreesareconsideredequaliftheyarestructurallyidenticalandthenod...
来源 2016-12-26 10:12
4
阅读

leetcode-99.+Recover+Binary+Search+Tree

leetcode-99.RecoverBinarySearchTree题目Twoelementsofabinarysearchtree(BST)areswappedbymistake.Recoverthetreewithoutchangingitsstructure.Note:AsolutionusingO(n)...
来源 2016-12-26 10:11
5
阅读

leetcode-98.+Validate+Binary+Search+Tree

leetcode-98.ValidateBinarySearchTree题目:Givenabinarytree,determineifitisavalidbinarysearchtree(BST).AssumeaBSTisdefinedasfollows:Theleftsubtreeofanodecontain...
来源 2016-12-26 10:08
4
阅读

leetcode-97.+Interleaving+String

leetcode-97.InterleavingString题目:Givens1,s2,s3,findwhethers3isformedbytheinterleavingofs1ands2.Forexample,Given:s1=“aabcc”,s2=“dbbca”,Whens3=“aadbbcbca...
来源 2016-12-26 10:04
3
阅读

leetcode-96.+Unique+Binary+Search+Trees

leetcode-96.UniqueBinarySearchTrees题目:Givenn,howmanystructurallyuniqueBST’s(binarysearchtrees)thatstorevalues1…n?Forexample,Givenn=3,thereareatotalof5uniq...
来源 2016-12-26 09:58
5
阅读

leetcode-95.+Unique+Binary+Search+Trees+II

leetcode-95.UniqueBinarySearchTreesII题目:Givenanintegern,generateallstructurallyuniqueBST’s(binarysearchtrees)thatstorevalues1…n.Forexample,Givenn=3,yourpr...
来源 2016-12-26 09:53
5
阅读

leetcode-94.+Binary+Tree+Inorder+Traversal

leetcode-94.BinaryTreeInorderTraversal题目:Givenabinarytree,returntheinordertraversalofitsnodes’values.Forexample:Givenbinarytree[1,null,2,3],1\2/3return[1,3...
来源 2016-12-26 09:45
4
阅读

leetcode-93.+Restore+IP+Addresses

leetcode-93.RestoreIPAddresses题目:Givenastringcontainingonlydigits,restoreitbyreturningallpossiblevalidIPaddresscombinations.Forexample:Given“25525511135”,...
来源 2016-12-26 09:40
5
阅读

leetcode-92.+Reverse+Linked+List+II

leetcode-92.ReverseLinkedListII题目:Reversealinkedlistfrompositionmton.Doitin-placeandinone-pass.Forexample:Given1-2-3-4-5-NULL,m=2andn=4,return1-4-3-2-5-NULL...
来源 2016-12-26 09:36
3
阅读

leetcode-91.+Decode+Ways

leetcode-91.DecodeWays题目:AmessagecontaininglettersfromA-Zisbeingencodedtonumbersusingthefollowingmapping:‘A’-1‘B’-2…‘Z’-26Givenanencodedmessagecontai...
来源 2016-12-26 09:32
2
阅读

LeetCode题解(1)--Two+Sum

Givenanarrayofintegers,returnindicesofthetwonumberssuchthattheyadduptoaspecifictarget.Youmayassumethateachinputwouldhaveexactlyonesolution.example[code]Givennu...
来源 2016-12-25 15:58
3
阅读

leetcode之Find+All+Numbers+Disappeared+in+an+Array

很久没有刷题了,感觉大脑开始迟钝,所以决定重拾刷题的乐趣。一开始不要太难,选一些通过率高的题目做,然后就看到了这个题目。我有些吃惊,这个题我虽然知道两种解法,...
来源 2016-12-24 18:21
3
阅读

leetcode-89.+Gray+Code

leetcode-89.GrayCode题目:Thegraycodeisabinarynumeralsystemwheretwosuccessivevaluesdifferinonlyonebit.Givenanon-negativeintegernrepresentingthetotalnumberofbit...
来源 2016-12-22 11:07
5
阅读

leetcode-87.+Scramble+String

leetcode-87.ScrambleString题目:Givenastrings1,wemayrepresentitasabinarytreebypartitioningittotwonon-emptysubstringsrecursively.Belowisonepossiblerepresentatio...
来源 2016-12-22 11:04
3
阅读

leetcode-85.+Maximal+Rectangle

leetcode-85.MaximalRectangle题目:Givena2Dbinarymatrixfilledwith0’sand1’s,findthelargestrectanglecontainingonly1’sandreturnitsarea.Forexample,giventhefollow...
来源 2016-12-22 10:58