摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2017-11-15 11:41 逸朵 阅读(138) 评论(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-11-15 11:35 逸朵 阅读(135) 评论(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-11-15 11:31 逸朵 阅读(106) 评论(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-11-15 11:26 逸朵 阅读(130) 评论(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-11-15 08:51 逸朵 阅读(112) 评论(0) 推荐(0)
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2017-11-15 08:33 逸朵 阅读(120) 评论(0) 推荐(0)
摘要: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", ret 阅读全文
posted @ 2017-11-15 08:21 逸朵 阅读(121) 评论(0) 推荐(0)
摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space i 阅读全文
posted @ 2017-11-15 05:57 逸朵 阅读(108) 评论(0) 推荐(0)
摘要: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2017-11-15 04:38 逸朵 阅读(108) 评论(0) 推荐(0)
摘要: Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should 阅读全文
posted @ 2017-11-15 04:02 逸朵 阅读(128) 评论(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-11-15 03:06 逸朵 阅读(184) 评论(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-11-15 01:46 逸朵 阅读(135) 评论(0) 推荐(0)
摘要: Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 阅读全文
posted @ 2017-11-15 01:29 逸朵 阅读(138) 评论(0) 推荐(0)