随笔分类 -  leedcode

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =... 阅读全文
posted @ 2015-07-22 18:48 ~每天进步一点点~ 阅读(111) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-07-22 17:54 ~每天进步一点点~ 阅读(115) 评论(0) 推荐(0)
摘要:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2015-07-22 13:10 ~每天进步一点点~ 阅读(147) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth... 阅读全文
posted @ 2015-07-21 23:47 ~每天进步一点点~ 阅读(178) 评论(0) 推荐(0)
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked list. ... 阅读全文
posted @ 2015-07-21 23:18 ~每天进步一点点~ 阅读(108) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for a binary tree node. * public cla... 阅读全文
posted @ 2015-07-21 22:51 ~每天进步一点点~ 阅读(97) 评论(0) 推荐(0)
摘要:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa... 阅读全文
posted @ 2015-07-21 22:41 ~每天进步一点点~ 阅读(123) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definiti... 阅读全文
posted @ 2015-07-21 21:39 ~每天进步一点点~ 阅读(134) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definitio... 阅读全文
posted @ 2015-07-21 21:12 ~每天进步一点点~ 阅读(184) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文
posted @ 2015-07-21 18:34 ~每天进步一点点~ 阅读(81) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2015-07-20 21:55 ~每天进步一点点~ 阅读(114) 评论(0) 推荐(0)
摘要:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文
posted @ 2015-07-20 21:50 ~每天进步一点点~ 阅读(145) 评论(0) 推荐(0)
摘要:Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文
posted @ 2015-07-20 21:18 ~每天进步一点点~ 阅读(144) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ... 阅读全文
posted @ 2015-07-20 16:59 ~每天进步一点点~ 阅读(120) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2015-07-16 23:08 ~每天进步一点点~ 阅读(119) 评论(0) 推荐(0)
摘要:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2015-07-16 23:03 ~每天进步一点点~ 阅读(198) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2015-07-16 22:17 ~每天进步一点点~ 阅读(126) 评论(0) 推荐(0)
摘要:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="... 阅读全文
posted @ 2015-07-16 21:58 ~每天进步一点点~ 阅读(226) 评论(0) 推荐(0)
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2015-07-16 20:51 ~每天进步一点点~ 阅读(173) 评论(0) 推荐(0)
摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2015-07-16 18:16 ~每天进步一点点~ 阅读(143) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页