随笔分类 -  Leetcode+题

上一页 1 ··· 4 5 6 7 8 9 下一页
摘要:Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return all 阅读全文
posted @ 2017-06-13 20:25 王大咩的图书馆 阅读(365) 评论(0) 推荐(0)
摘要:Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2017-06-13 17:12 王大咩的图书馆 阅读(2815) 评论(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 @ 2017-06-13 15:53 王大咩的图书馆 阅读(372) 评论(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 @ 2017-06-13 10:46 王大咩的图书馆 阅读(360) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2017-06-12 22:18 王大咩的图书馆 阅读(385) 评论(0) 推荐(0)
摘要:Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution sti 阅读全文
posted @ 2017-06-11 15:57 王大咩的图书馆 阅读(363) 评论(0) 推荐(0)
摘要:Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL. 阅读全文
posted @ 2017-06-11 10:54 王大咩的图书馆 阅读(344) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2017-06-11 09:43 王大咩的图书馆 阅读(418) 评论(0) 推荐(0)
摘要:Given 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 tree andsum 阅读全文
posted @ 2017-06-10 22:40 王大咩的图书馆 阅读(360) 评论(0) 推荐(0)
摘要:Given 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 given sum. F 阅读全文
posted @ 2017-06-10 21:24 王大咩的图书馆 阅读(373) 评论(0) 推荐(0)
摘要:Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example:Given the below binary tree, Return6. 阅读全文
posted @ 2017-06-10 21:03 王大咩的图书馆 阅读(302) 评论(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 @ 2017-06-10 16:46 王大咩的图书馆 阅读(332) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-06-10 15:35 王大咩的图书馆 阅读(361) 评论(1) 推荐(0)
摘要:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number. An example is the root-to-leaf path1->2->3which re 阅读全文
posted @ 2017-06-09 22:25 王大咩的图书馆 阅读(545) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 利用前序和中序遍历构造二 阅读全文
posted @ 2017-06-09 09:29 王大咩的图书馆 阅读(586) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 利用中序和后序遍历构造 阅读全文
posted @ 2017-06-08 16:54 王大咩的图书馆 阅读(426) 评论(0) 推荐(0)
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2017-06-08 15:26 王大咩的图书馆 阅读(399) 评论(0) 推荐(0)
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2017-06-08 14:29 王大咩的图书馆 阅读(1997) 评论(0) 推荐(0)
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree{3, 阅读全文
posted @ 2017-06-08 11:07 王大咩的图书馆 阅读(1848) 评论(0) 推荐(0)
摘要:Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree{1,#,2,3}, return[3,2,1]. Note: Recursive solut 阅读全文
posted @ 2017-06-08 09:14 王大咩的图书馆 阅读(485) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 下一页