10 2015 档案

摘要:Search a 2D MatrixWrite an efficient algorithm that searches for a value in anmxnmatrix.This matrix has the following properties:Integers in each row ... 阅读全文
posted @ 2015-10-30 07:07 Tri_tri_tri 阅读(199) 评论(0) 推荐(0)
摘要:Topological SortingGiven an directed graph, a topological order of the graph nodes is defined as follow:For each directed edgeA -> Bin graph, A must b... 阅读全文
posted @ 2015-10-30 02:07 Tri_tri_tri 阅读(203) 评论(0) 推荐(0)
摘要:Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l... 阅读全文
posted @ 2015-10-29 10:55 Tri_tri_tri 阅读(205) 评论(0) 推荐(0)
摘要:Permutations IIGiven a list of numbers with duplicate number in it. Find alluniquepermutations.ExampleFor numbers[1,2,2]the unique permutations are:[ ... 阅读全文
posted @ 2015-10-28 23:47 Tri_tri_tri 阅读(161) 评论(0) 推荐(0)
摘要:PermutationsGiven a list of numbers, return all possible permutations.ExampleFor nums =[1,2,3], the permutations are:[ [1,2,3], [1,3,2], [2,1,3], ... 阅读全文
posted @ 2015-10-28 23:12 Tri_tri_tri 阅读(260) 评论(0) 推荐(0)
摘要:Subsets IIGiven a list of numbers that may has duplicate numbers, return all possible subsetsExampleIfS=[1,2,2], a solution is:[ [2], [1], [1,2,2],... 阅读全文
posted @ 2015-10-28 23:02 Tri_tri_tri 阅读(133) 评论(0) 推荐(0)
摘要:SubsetsGiven a set of distinct integers, return all possible subsets.ExampleIfS=[1,2,3], a solution is:[ [3], [1], [2], [1,2,3], [1,3], [2,3], ... 阅读全文
posted @ 2015-10-28 22:50 Tri_tri_tri 阅读(247) 评论(0) 推荐(0)
摘要:Search Range in Binary Search TreeGiven two values k1 and k2 (where k1 k2 也就是说这个指针已经出了给定的条件了,这时候就没必要再往这个方向DFS了,再往下走结果也不会满足条件了。再仔细的说一下,就是,只有在rootk2的时候... 阅读全文
posted @ 2015-10-08 00:21 Tri_tri_tri 阅读(138) 评论(0) 推荐(0)
摘要:Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then... 阅读全文
posted @ 2015-10-07 23:54 Tri_tri_tri 阅读(166) 评论(0) 推荐(0)
摘要:Binary Tree Level Order Traversal IGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).... 阅读全文
posted @ 2015-10-07 12:06 Tri_tri_tri 阅读(140) 评论(0) 推荐(0)
摘要: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.ExampleGiven the below b... 阅读全文
posted @ 2015-10-07 11:13 Tri_tri_tri 阅读(161) 评论(0) 推荐(0)
摘要:Lowest Common Ancestor Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancesto 阅读全文
posted @ 2015-10-07 07:23 Tri_tri_tri 阅读(225) 评论(0) 推荐(0)
摘要:Inorder Successor in BSTGiven a binary search tree and a node in it, find the in-order successor of that node in the BST.ExampleGiven tree =[2,1]and n... 阅读全文
posted @ 2015-10-07 02:12 Tri_tri_tri 阅读(419) 评论(0) 推荐(0)
摘要: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 @ 2015-10-07 00:07 Tri_tri_tri 阅读(137) 评论(0) 推荐(0)
摘要: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 @ 2015-10-06 12:18 Tri_tri_tri 阅读(153) 评论(0) 推荐(0)
摘要: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 @ 2015-10-06 11:57 Tri_tri_tri 阅读(157) 评论(0) 推荐(0)
摘要:Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.ExampleGiven binary tree{1,#,2,3}, 1 \ 2 ... 阅读全文
posted @ 2015-10-06 11:15 Tri_tri_tri 阅读(159) 评论(0) 推荐(0)
摘要:Binary Tree Preorder TraversalGiven a binary tree, return the preorder traversal of its nodes' values.ExampleGiven binary tree{1,#,2,3}:1 \ 2 /3retur... 阅读全文
posted @ 2015-10-06 10:45 Tri_tri_tri 阅读(130) 评论(0) 推荐(0)