题目如下: Given preorder and inorder traversal of a tree, construct the binary tree. eg: preorder = [3,9,20,15,7] inorder = [9,3,15,20,7] return: 3 / \ 9 20 / \ 15 7 已知二叉树的前序遍历序列和中… 阅读全文
标签: LeetCode
[LeetCode每日一题]101. Symmetric Tree
题目如下: 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 symmetric: eg: 1 / \ 2 2 / \ /… 阅读全文
[LeetCode每日一题]100. Same Tree
题目如下: 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 identical and the nodes have the same value. Leet… 阅读全文
[LeetCode每日一题]99. Recover Binary Search Tree
题目如下: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. LeetCode-99 Recover Binary Search Tree 该题给定一棵二叉搜索树,树中正好有两个元素放反了,要求我们恢复这棵二叉搜索树。… 阅读全文