Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to …
标签:LeetCode题目解答汇总
LeetCode | Maximum Depth of Binary Tree(二叉树的深度)
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path f…
LeetCode | Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicate…
LeetCode | Binary Tree Level Order Traversal II(二叉树层序遍历II)
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, fro…
LeetCode | Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicat…
LeetCode | Convert Sorted Array to Binary Search Tree(有序数组转换成平衡二叉树搜索树)
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目解析: 给定一个有序…
LeetCode | Balanced Binary Tree(平衡二叉树)
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is de…
LeetCode | Convert Sorted List to Binary Search Tree(链表转换成二叉搜索树)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. …
LeetCode | Minimum Depth of Binary Tree(树的最短路径)
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path …
LeetCode | Path Sum(路径和)
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the value…
LeetCode | Path Sum II(路径和2)
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. F…
LeetCode | Flatten Binary Tree to Linked List(二叉树转化成链表)
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flatte…