摘要: Given n, how many structurally unique BSTs (binary search trees) that store values 1...n? Given n, how many structurally unique BSTs (binary search tr 阅读全文
posted @ 2016-07-08 23:11 北叶青藤 阅读(183) 评论(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 l 阅读全文
posted @ 2016-07-08 11:30 北叶青藤 阅读(153) 评论(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 阅读全文
posted @ 2016-07-08 10:29 北叶青藤 阅读(170) 评论(0) 推荐(0)
摘要: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Example Given the below binary tree: 1 / \ 2 3 ret 阅读全文
posted @ 2016-07-08 10:19 北叶青藤 阅读(230) 评论(0) 推荐(0)
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2016-07-08 05:14 北叶青藤 阅读(157) 评论(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 dept 阅读全文
posted @ 2016-07-08 04:05 北叶青藤 阅读(191) 评论(0) 推荐(0)
摘要: Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancestor is the node with larg 阅读全文
posted @ 2016-07-08 02:55 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要: Design an iterator over a binary search tree with the following rules: Elements are visited in ascending order (i.e. an in-order traversal) next() and 阅读全文
posted @ 2016-07-08 02:39 北叶青藤 阅读(171) 评论(0) 推荐(0)
摘要: Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification What's the de 阅读全文
posted @ 2016-07-08 00:58 北叶青藤 阅读(247) 评论(0) 推荐(0)
摘要: Given inorder and postorder traversal of a tree, construct the binary tree. Notice You may assume that duplicates do not exist in the tree. Given inor 阅读全文
posted @ 2016-07-08 00:21 北叶青藤 阅读(220) 评论(0) 推荐(0)