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-10
🟡3719.longest-balanced-subarray-i
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
🟡3719.longest-balanced-subarray-i
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
Telegraph
longest-balanced-subarray-i
给你一个整数数组 nums。
leetcode.com 2026-02-10
🟡3719.longest-balanced-subarray-i
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
🟡3719.longest-balanced-subarray-i
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
Telegraph
longest-balanced-subarray-i
You are given an integer array nums. A subarray is called balanced if the number of distinct even numbers in the subarray is equal to the number of distinct odd numbers. Return the length of the longest balanced subarray. Example 1: Input: nums = [2,5,4…
leetcode.cn 2026-02-11
🔴3721.longest-balanced-subarray-ii
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
🔴3721.longest-balanced-subarray-ii
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
Telegraph
longest-balanced-subarray-ii
给你一个整数数组 nums。
leetcode.com 2026-02-11
🔴3721.longest-balanced-subarray-ii
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
🔴3721.longest-balanced-subarray-ii
🏷️ Tags
#segment_tree #array #hash_table #divide_and_conquer #prefix_sum
Telegraph
longest-balanced-subarray-ii
You are given an integer array nums. A subarray is called balanced if the number of distinct even numbers in the subarray is equal to the number of distinct odd numbers. Return the length of the longest balanced subarray. Example 1: Input: nums = [2,5,4…
leetcode.cn 2026-02-12
🟡3713.longest-balanced-substring-i
🏷️ Tags
#hash_table #string #counting #enumeration
🟡3713.longest-balanced-substring-i
🏷️ Tags
#hash_table #string #counting #enumeration
Telegraph
longest-balanced-substring-i
给你一个由小写英文字母组成的字符串 s。
leetcode.com 2026-02-12
🟡3713.longest-balanced-substring-i
🏷️ Tags
#hash_table #string #counting #enumeration
🟡3713.longest-balanced-substring-i
🏷️ Tags
#hash_table #string #counting #enumeration
Telegraph
longest-balanced-substring-i
You are given a string s consisting of lowercase English letters. A substring of s is called balanced if all distinct characters in the substring appear the same number of times. Return the length of the longest balanced substring of s. Example 1: Input:…