leetcode.cn 2026-01-07
🟡1339.maximum-product-of-splitted-binary-tree
🏷️ Tags
#tree #depth_first_search #binary_tree
🟡1339.maximum-product-of-splitted-binary-tree
🏷️ Tags
#tree #depth_first_search #binary_tree
Telegraph
maximum-product-of-splitted-binary-tree
给你一棵二叉树,它的根为 root 。请你删除 1 条边,使二叉树分裂成两棵子树,且它们子树和的乘积尽可能大。 由于答案可能会很大,请你将结果对 10^9 + 7 取模后再返回。 示例 1: 输入:root = [1,2,3,4,5,6] 输出:110 解释:删除红色的边,得到 2 棵子树,和分别为 11 和 10 。它们的乘积是 110 (11*10) 示例 2: 输入:root = [1,null,2,3,4,null,null,5,6] 输出:90 解释:移除红色的边,得到 2 棵子树,和分别是…
leetcode.com 2026-01-07
🟡1339.maximum-product-of-splitted-binary-tree
🏷️ Tags
#tree #depth_first_search #binary_tree
🟡1339.maximum-product-of-splitted-binary-tree
🏷️ Tags
#tree #depth_first_search #binary_tree
Telegraph
maximum-product-of-splitted-binary-tree
Given the root of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is maximized. Return the maximum product of the sums of the two subtrees. Since the answer may be too large, return…
leetcode.cn 2026-01-09
🟡865.smallest-subtree-with-all-the-deepest-nodes
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
🟡865.smallest-subtree-with-all-the-deepest-nodes
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
Telegraph
smallest-subtree-with-all-the-deepest-nodes
给定一个根为 root 的二叉树,每个节点的深度是 该节点到根的最短距离 。 返回包含原始树中所有 最深节点 的 最小子树 。 如果一个节点在 整个树 的任意节点之间具有最大的深度,则该节点是 最深的 。 一个节点的 子树 是该节点加上它的所有后代的集合。 示例 1: 输入:root = [3,5,1,6,2,0,8,null,null,7,4] 输出:[2,7,4] 解释: 我们返回值为 2 的节点,在图中用黄色标记。 在图中用蓝色标记的是树的最深的节点。 注意,节点 5、3 和 2 包含树中最深的节点,但节点…
leetcode.com 2026-01-09
🟡865.smallest-subtree-with-all-the-deepest-nodes
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
🟡865.smallest-subtree-with-all-the-deepest-nodes
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
Telegraph
smallest-subtree-with-all-the-deepest-nodes
Given the root of a binary tree, the depth of each node is the shortest distance to the root. Return the smallest subtree such that it contains all the deepest nodes in the original tree. A node is called the deepest if it has the largest depth possible among…
leetcode.cn 2026-02-09
🟡1382.balance-a-binary-search-tree
🏷️ Tags
#greedy #tree #depth_first_search #binary_search_tree #divide_and_conquer #binary_tree
🟡1382.balance-a-binary-search-tree
🏷️ Tags
#greedy #tree #depth_first_search #binary_search_tree #divide_and_conquer #binary_tree
Telegraph
balance-a-binary-search-tree
给你一棵二叉搜索树,请你返回一棵 平衡后 的二叉搜索树,新生成的树应该与原来的树有着相同的节点值。如果有多种构造方法,请你返回任意一种。 如果一棵二叉搜索树中,每个节点的两棵子树高度差不超过 1 ,我们就称这棵二叉搜索树是 平衡的 。 示例 1: 输入:root = [1,null,2,null,3,null,4,null,null] 输出:[2,1,3,null,null,null,4] 解释:这不是唯一的正确答案,[3,1,4,null,2,null,null] 也是一个可行的构造方案。 示例 2:…
leetcode.com 2026-02-09
🟡1382.balance-a-binary-search-tree
🏷️ Tags
#greedy #tree #depth_first_search #binary_search_tree #divide_and_conquer #binary_tree
🟡1382.balance-a-binary-search-tree
🏷️ Tags
#greedy #tree #depth_first_search #binary_search_tree #divide_and_conquer #binary_tree
Telegraph
balance-a-binary-search-tree
Given the root of a binary search tree, return a balanced binary search tree with the same node values. If there is more than one answer, return any of them. A binary search tree is balanced if the depth of the two subtrees of every node never differs by…
leetcode.cn 2026-02-24
🟢1022.sum-of-root-to-leaf-binary-numbers
🏷️ Tags
#tree #depth_first_search #binary_tree
🟢1022.sum-of-root-to-leaf-binary-numbers
🏷️ Tags
#tree #depth_first_search #binary_tree
Telegraph
sum-of-root-to-leaf-binary-numbers
给出一棵二叉树,其上每个结点的值都是 0 或 1 。每一条从根到叶的路径都代表一个从最高有效位开始的二进制数。
leetcode.com 2026-02-24
🟢1022.sum-of-root-to-leaf-binary-numbers
🏷️ Tags
#tree #depth_first_search #binary_tree
🟢1022.sum-of-root-to-leaf-binary-numbers
🏷️ Tags
#tree #depth_first_search #binary_tree
Telegraph
sum-of-root-to-leaf-binary-numbers
You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.