摘要: 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 阅读全文
posted @ 2016-05-19 11:49 Black_Knight 阅读(189) 评论(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 @ 2016-05-18 12:00 Black_Knight 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-05-12 10:45 Black_Knight 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-05-10 17:56 Black_Knight 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-05-10 10:37 Black_Knight 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 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" 阅读全文
posted @ 2016-05-10 10:29 Black_Knight 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Total Accepted: 46445 Total Submissions: 122594 Difficulty: Medium Given a binary search tree, write a function kthSmallest to find the kth smallest e 阅读全文
posted @ 2016-05-09 20:17 Black_Knight 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Total Accepted: 32628 Total Submissions: 129569 Difficulty: Medium Given a complete binary tree, count the number of nodes. Definition of a complete b 阅读全文
posted @ 2016-05-09 09:28 Black_Knight 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-05-06 09:41 Black_Knight 阅读(245) 评论(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 @ 2016-05-05 10:09 Black_Knight 阅读(475) 评论(0) 推荐(0) 编辑