随笔分类 -  recurse

1 2 下一页

[leetcode]Convert Sorted List to Binary Search Tree
摘要:Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.... 阅读全文

posted @ 2014-08-16 10:51 喵星人与汪星人 阅读(316) 评论(0) 推荐(0)

[leetcode]Sum Root to Leaf Numbers
摘要:Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l... 阅读全文

posted @ 2014-08-16 00:45 喵星人与汪星人 阅读(211) 评论(0) 推荐(0)

[leetcode]Unique Binary Search Trees II
摘要:Unique Binary Search Trees IIGivenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your pr... 阅读全文

posted @ 2014-08-15 22:55 喵星人与汪星人 阅读(293) 评论(0) 推荐(0)

[leetcode]Interleaving String
摘要:Interleaving StringGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文

posted @ 2014-08-15 21:25 喵星人与汪星人 阅读(399) 评论(0) 推荐(0)

[leetcode]Binary Tree Maximum Path Sum
摘要:Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be... 阅读全文

posted @ 2014-08-11 19:43 喵星人与汪星人 阅读(216) 评论(0) 推荐(0)

[leetcode]Binary Tree Postorder Traversal
摘要:Binary Tree Postorder TraversalGiven a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \... 阅读全文

posted @ 2014-08-08 22:00 喵星人与汪星人 阅读(163) 评论(0) 推荐(0)

[leetcode]Flatten Binary Tree to Linked List
摘要:Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ... 阅读全文

posted @ 2014-08-07 22:53 喵星人与汪星人 阅读(217) 评论(0) 推荐(0)

[leetcode]Word Break
摘要:Word BreakGiven a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.... 阅读全文

posted @ 2014-08-05 01:06 喵星人与汪星人 阅读(639) 评论(0) 推荐(0)

[leetcode]Text Justification
摘要:Text JustificationGiven an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) just... 阅读全文

posted @ 2014-08-01 19:21 喵星人与汪星人 阅读(999) 评论(0) 推荐(0)

[leetcode]Path Sum II
摘要:Path Sum IIGiven 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 tr... 阅读全文

posted @ 2014-07-31 20:29 喵星人与汪星人 阅读(155) 评论(0) 推荐(0)

[leetcode]Path Sum
摘要:Path SumGiven 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 give... 阅读全文

posted @ 2014-07-31 20:27 喵星人与汪星人 阅读(226) 评论(0) 推荐(0)

[leetcode]Balanced Binary Tree
摘要:Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre... 阅读全文

posted @ 2014-07-31 20:22 喵星人与汪星人 阅读(230) 评论(0) 推荐(0)

[leetcode]Convert Sorted Array to Binary Search Tree
摘要:Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.算法:根据有序数组,生... 阅读全文

posted @ 2014-07-31 20:19 喵星人与汪星人 阅读(150) 评论(0) 推荐(0)

[leetcode]Construct Binary Tree from Inorder and Postorder Traversal
摘要:Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu... 阅读全文

posted @ 2014-07-31 20:16 喵星人与汪星人 阅读(233) 评论(0) 推荐(0)

[leetcode]Construct Binary Tree from Preorder and Inorder Traversal
摘要:Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume... 阅读全文

posted @ 2014-07-31 20:11 喵星人与汪星人 阅读(217) 评论(0) 推荐(0)

[leetcode]Minimum Depth of Binary Tree
摘要:Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文

posted @ 2014-07-31 20:06 喵星人与汪星人 阅读(219) 评论(0) 推荐(0)

[leetcode]Maximum Depth of Binary Tree
摘要:Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ... 阅读全文

posted @ 2014-07-31 20:02 喵星人与汪星人 阅读(137) 评论(0) 推荐(0)

[leetcode]Same Tree
摘要:Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ide... 阅读全文

posted @ 2014-07-31 19:56 喵星人与汪星人 阅读(154) 评论(0) 推荐(0)

[leetcode]Symmetric Tree
摘要:Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric... 阅读全文

posted @ 2014-07-31 19:53 喵星人与汪星人 阅读(171) 评论(0) 推荐(0)

[leetcode]Validate Binary Search Tree
摘要:Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre... 阅读全文

posted @ 2014-07-31 19:39 喵星人与汪星人 阅读(195) 评论(0) 推荐(0)

1 2 下一页