摘要: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might 阅读全文
posted @ 2018-12-29 18:11 fatttcat 阅读(131) 评论(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 @ 2018-12-29 17:14 fatttcat 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E 阅读全文
posted @ 2018-12-29 16:47 fatttcat 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given a n-ary 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 le 阅读全文
posted @ 2018-12-29 15:28 fatttcat 阅读(78) 评论(0) 推荐(0) 编辑
摘要: Find the sum of all left leaves in a given binary tree. Example: M1: recursive time: O(n), space: O(height) M2: iterative 对于每一个节点,检查它的left child是不是lea 阅读全文
posted @ 2018-12-29 15:09 fatttcat 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example, given a 3-ary tree: 阅读全文
posted @ 2018-12-29 05:42 fatttcat 阅读(155) 评论(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 @ 2018-12-29 05:25 fatttcat 阅读(135) 评论(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 @ 2018-12-29 05:04 fatttcat 阅读(117) 评论(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 @ 2018-12-29 04:49 fatttcat 阅读(112) 评论(0) 推荐(0) 编辑