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 ...
阅读全文
摘要: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...
阅读全文
摘要:Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l...
阅读全文
摘要:Permutations IIGiven a list of numbers with duplicate number in it. Find alluniquepermutations.ExampleFor numbers[1,2,2]the unique permutations are:[ ...
阅读全文
摘要: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], ...
阅读全文
摘要: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],...
阅读全文
摘要: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], ...
阅读全文
摘要:Search Range in Binary Search TreeGiven two values k1 and k2 (where k1 k2 也就是说这个指针已经出了给定的条件了,这时候就没必要再往这个方向DFS了,再往下走结果也不会满足条件了。再仔细的说一下,就是,只有在rootk2的时候...
阅读全文
摘要:Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then...
阅读全文
摘要:Binary Tree Level Order Traversal IGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level)....
阅读全文
摘要: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...
阅读全文
摘要: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
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要:Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.ExampleGiven binary tree{1,#,2,3}, 1 \ 2 ...
阅读全文
摘要:Binary Tree Preorder TraversalGiven a binary tree, return the preorder traversal of its nodes' values.ExampleGiven binary tree{1,#,2,3}:1 \ 2 /3retur...
阅读全文
浙公网安备 33010602011771号