摘要: Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2018-12-30 17:51 fatttcat 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2018-12-30 11:36 fatttcat 阅读(101) 评论(0) 推荐(0) 编辑
摘要: If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers. For each integer in this list: Given a 阅读全文
posted @ 2018-12-30 11:23 fatttcat 阅读(144) 评论(0) 推荐(0) 编辑
摘要: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2018-12-30 10:58 fatttcat 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文
posted @ 2018-12-30 10:41 fatttcat 阅读(85) 评论(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. N 阅读全文
posted @ 2018-12-30 10:07 fatttcat 阅读(77) 评论(0) 推荐(0) 编辑
摘要: You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2018-12-30 10:00 fatttcat 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and o 阅读全文
posted @ 2018-12-30 09:43 fatttcat 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. 阅读全文
posted @ 2018-12-30 09:14 fatttcat 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文
posted @ 2018-12-30 08:28 fatttcat 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2018-12-30 07:32 fatttcat 阅读(153) 评论(0) 推荐(0) 编辑