随笔分类 -  dfs

1 2 下一页

[leecode]Word Break II
摘要:Word Break IIGiven a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all... 阅读全文

posted @ 2014-08-24 22:49 喵星人与汪星人 阅读(282) 评论(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 喵星人与汪星人 阅读(201) 评论(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 喵星人与汪星人 阅读(281) 评论(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 喵星人与汪星人 阅读(389) 评论(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 喵星人与汪星人 阅读(210) 评论(0) 推荐(0) 编辑

[leetcode]Sudoku Solver
摘要:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that the... 阅读全文

posted @ 2014-08-09 21:17 喵星人与汪星人 阅读(212) 评论(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 喵星人与汪星人 阅读(159) 评论(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 喵星人与汪星人 阅读(208) 评论(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 喵星人与汪星人 阅读(629) 评论(0) 推荐(0) 编辑

[leetcode]Edit distance
摘要:Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文

posted @ 2014-08-01 22:36 喵星人与汪星人 阅读(385) 评论(0) 推荐(0) 编辑

[leetcode]Populating Next Right Pointers in Each Node II
摘要:Populating Next Right Pointers in Each Node IIFollow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any ... 阅读全文

posted @ 2014-07-31 20:40 喵星人与汪星人 阅读(174) 评论(0) 推荐(0) 编辑

[leetcode]Populating Next Right Pointers in Each Node
摘要:Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi... 阅读全文

posted @ 2014-07-31 20:35 喵星人与汪星人 阅读(244) 评论(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 喵星人与汪星人 阅读(151) 评论(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 喵星人与汪星人 阅读(218) 评论(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 喵星人与汪星人 阅读(223) 评论(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 喵星人与汪星人 阅读(127) 评论(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 喵星人与汪星人 阅读(148) 评论(0) 推荐(0) 编辑

[leetcode]Recover Binary Search Tree
摘要:Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol... 阅读全文

posted @ 2014-07-31 19:47 喵星人与汪星人 阅读(232) 评论(0) 推荐(0) 编辑

[leetcode]Subsets II
摘要:Subsets IIGiven a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descend... 阅读全文

posted @ 2014-07-25 22:57 喵星人与汪星人 阅读(251) 评论(0) 推荐(0) 编辑

[leetcode]Subsets
摘要:SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must... 阅读全文

posted @ 2014-07-25 22:40 喵星人与汪星人 阅读(236) 评论(0) 推荐(0) 编辑

1 2 下一页