摘要:
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou 阅读全文
摘要:
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 阅读全文
摘要:
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
摘要:
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
摘要:
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5" 阅读全文
摘要:
Total Accepted: 46445 Total Submissions: 122594 Difficulty: Medium Given a binary search tree, write a function kthSmallest to find the kth smallest e 阅读全文
摘要:
Total Accepted: 32628 Total Submissions: 129569 Difficulty: Medium Given a complete binary tree, count the number of nodes. Definition of a complete b 阅读全文
摘要:
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa 阅读全文
摘要:
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 相比较通过前序序列和中序 阅读全文