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-01-10
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
Telegraph
minimum-ascii-delete-sum-for-two-strings
给定两个字符串s1 和 s2,返回 使两个字符串相等所需删除字符的 ASCII 值的最小和 。 示例 1: 输入: s1 = "sea", s2 = "eat" 输出: 231 解释: 在 "sea" 中删除 "s" 并将 "s" 的值(115)加入总和。 在 "eat" 中删除 "t" 并将 116 加入总和。 结束时,两个字符串相等,115 + 116 = 231 就是符合条件的最小和。 示例 2: 输入: s1 = "delete", s2 = "leet" 输出: 403 解释: 在 "delete"…
leetcode.com 2026-01-10
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
Telegraph
minimum-ascii-delete-sum-for-two-strings
Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output: 231 Explanation: Deleting "s" from "sea" adds the ASCII value of "s" (115) to the sum. Deleting "t"…
leetcode.cn 2026-01-11
🔴85.maximal-rectangle
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🔴85.maximal-rectangle
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
maximal-rectangle
给定一个仅包含 0 和 1 、大小为 rows x cols 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。 示例 1: 输入:matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] 输出:6 解释:最大矩形如上图所示。 示例 2: 输入:matrix = [["0"]] 输出:0 示例 3: 输入:matrix = [["1"]] 输出:1 …
leetcode.com 2026-01-11
🔴85.maximal-rectangle
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🔴85.maximal-rectangle
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
maximal-rectangle
Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] Output: 6…
leetcode.cn 2026-01-14
🔴3454.separate-squares-ii
🏷️ Tags
#segment_tree #array #binary_search #line_sweep
🔴3454.separate-squares-ii
🏷️ Tags
#segment_tree #array #binary_search #line_sweep
Telegraph
separate-squares-ii
给你一个二维整数数组 squares ,其中 squares[i] = [xi, yi, li] 表示一个与 x 轴平行的正方形的左下角坐标和正方形的边长。 找到一个最小的 y 坐标,它对应一条水平线,该线需要满足它以上正方形的总面积 等于 该线以下正方形的总面积。 答案如果与实际答案的误差在 10-5 以内,将视为正确答案。 注意:正方形 可能会 重叠。重叠区域只 统计一次 。 示例 1: 输入: squares = [[0,0,1],[2,2,1]] 输出: 1.00000 解释: 任何在 y =…
leetcode.com 2026-01-14
🔴3454.separate-squares-ii
🏷️ Tags
#segment_tree #array #binary_search #line_sweep
🔴3454.separate-squares-ii
🏷️ Tags
#segment_tree #array #binary_search #line_sweep
Telegraph
separate-squares-ii
You are given a 2D integer array squares. Each squares[i] = [xi, yi, li] represents the coordinates of the bottom-left point and the side length of a square parallel to the x-axis. Find the minimum y-coordinate value of a horizontal line such that the total…
leetcode.cn 2026-01-16
🟡2975.maximum-square-area-by-removing-fences-from-a-field
🏷️ Tags
#array #hash_table #enumeration
🟡2975.maximum-square-area-by-removing-fences-from-a-field
🏷️ Tags
#array #hash_table #enumeration
Telegraph
maximum-square-area-by-removing-fences-from-a-field
有一个大型的 (m - 1) x (n - 1) 矩形田地,其两个对角分别是 (1, 1) 和 (m, n) ,田地内部有一些水平栅栏和垂直栅栏,分别由数组 hFences 和 vFences 给出。 水平栅栏为坐标 (hFences[i], 1) 到 (hFences[i], n),垂直栅栏为坐标 (1, vFences[i]) 到 (m, vFences[i]) 。 返回通过 移除 一些栅栏(可能不移除)所能形成的最大面积的 正方形 田地的面积,或者如果无法形成正方形田地则返回 -1。 由于答案可能很大,所以请返回结果对…
leetcode.com 2026-01-16
🟡2975.maximum-square-area-by-removing-fences-from-a-field
🏷️ Tags
#array #hash_table #enumeration
🟡2975.maximum-square-area-by-removing-fences-from-a-field
🏷️ Tags
#array #hash_table #enumeration
Telegraph
maximum-square-area-by-removing-fences-from-a-field
There is a large (m - 1) x (n - 1) rectangular field with corners at (1, 1) and (m, n) containing some horizontal and vertical fences given in arrays hFences and vFences respectively. Horizontal fences are from the coordinates (hFences[i], 1) to (hFences[i]…
leetcode.cn 2026-01-17
🟡3047.find-the-largest-area-of-square-inside-two-rectangles
🏷️ Tags
#geometry #array #math
🟡3047.find-the-largest-area-of-square-inside-two-rectangles
🏷️ Tags
#geometry #array #math
Telegraph
find-the-largest-area-of-square-inside-two-rectangles
在二维平面上存在 n 个矩形。给你两个下标从 0 开始的二维整数数组 bottomLeft 和 topRight,两个数组的大小都是 n x 2 ,其中 bottomLeft[i] 和 topRight[i] 分别代表第 i 个矩形的 左下角 和 右上角 坐标。 我们定义 向右 的方向为 x 轴正半轴(x 坐标增加),向左 的方向为 x 轴负半轴(x 坐标减少)。同样地,定义 向上 的方向为 y 轴正半轴(y 坐标增加),向下 的方向为 y 轴负半轴(y 坐标减少)。 你可以选择一个区域,该区域由两个矩形的…