leetcode.com 2023-08-05
🟡95.unique-binary-search-trees-ii
🏷️ Tags
#tree #binary_search_tree #dynamic_programming #backtracking #binary_tree
🟡95.unique-binary-search-trees-ii
🏷️ Tags
#tree #binary_search_tree #dynamic_programming #backtracking #binary_tree
Telegraph
unique-binary-search-trees-ii
Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order. Example 1: Input: n = 3 Output: [[1,null,2,null,3],[1,null,3,2],[2,1,3],[3,1,null…
leetcode.cn 2023-12-09
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#math #backtracking #enumeration
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#math #backtracking #enumeration
Telegraph
next-greater-numerically-balanced-number
如果整数 x 满足:对于每个数位 d ,这个数位 恰好 在 x 中出现 d 次。那么整数 x 就是一个 数值平衡数 。 给你一个整数 n ,请你返回 严格大于 n 的 最小数值平衡数 。 示例 1: 输入:n = 1 输出:22 解释: 22 是一个数值平衡数,因为: - 数字 2 出现 2 次 这也是严格大于 1 的最小数值平衡数。 示例 2: 输入:n = 1000 输出:1333 解释: 1333 是一个数值平衡数,因为: - 数字 1 出现 1 次。 - 数字 3 出现 3 次。 这也是严格大于…
leetcode.cn 2024-01-04
🟡2397.maximum-rows-covered-by-columns
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration #matrix
🟡2397.maximum-rows-covered-by-columns
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration #matrix
Telegraph
maximum-rows-covered-by-columns
给你一个下标从 0 开始、大小为 m x n 的二进制矩阵 matrix ;另给你一个整数 numSelect,表示你必须从 matrix 中选择的 不同 列的数量。 如果一行中所有的 1 都被你选中的列所覆盖,则认为这一行被 覆盖 了。 形式上,假设 s = {c1, c2, ...., cnumSelect} 是你选择的列的集合。对于矩阵中的某一行 row ,如果满足下述条件,则认为这一行被集合 s 覆盖:
leetcode.com 2024-01-23
🟡1239.maximum-length-of-a-concatenated-string-with-unique-characters
🏷️ Tags
#bit_manipulation #array #string #backtracking
🟡1239.maximum-length-of-a-concatenated-string-with-unique-characters
🏷️ Tags
#bit_manipulation #array #string #backtracking
Telegraph
maximum-length-of-a-concatenated-string-with-unique-characters
You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximum possible length of s. A subsequence is an array that can be derived from another array by deleting some…
leetcode.cn 2025-03-07
🟡2597.the-number-of-beautiful-subsets
🏷️ Tags
#array #hash_table #math #dynamic_programming #backtracking #combinatorics #sorting
🟡2597.the-number-of-beautiful-subsets
🏷️ Tags
#array #hash_table #math #dynamic_programming #backtracking #combinatorics #sorting
Telegraph
the-number-of-beautiful-subsets
给你一个由正整数组成的数组 nums 和一个 正 整数 k 。 如果 nums 的子集中,任意两个整数的绝对差均不等于 k ,则认为该子数组是一个 美丽 子集。 返回数组 nums 中 非空 且 美丽 的子集数目。 nums 的子集定义为:可以经由 nums 删除某些元素(也可能不删除)得到的一个数组。只有在删除元素时选择的索引不同的情况下,两个子集才会被视作是不同的子集。 示例 1: 输入:nums = [2,4,6], k = 2 输出:4 解释:数组 nums 中的美丽子集有:[2], [4]…
leetcode.cn 2025-04-05
🟢1863.sum-of-all-subset-xor-totals
🏷️ Tags
#bit_manipulation #array #math #backtracking #combinatorics #enumeration
🟢1863.sum-of-all-subset-xor-totals
🏷️ Tags
#bit_manipulation #array #math #backtracking #combinatorics #enumeration
Telegraph
sum-of-all-subset-xor-totals
一个数组的 异或总和 定义为数组中所有元素按位 XOR 的结果;如果数组为 空 ,则异或总和为 0 。
leetcode.com 2025-04-05
🟢1863.sum-of-all-subset-xor-totals
🏷️ Tags
#bit_manipulation #array #math #backtracking #combinatorics #enumeration
🟢1863.sum-of-all-subset-xor-totals
🏷️ Tags
#bit_manipulation #array #math #backtracking #combinatorics #enumeration
Telegraph
sum-of-all-subset-xor-totals
The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.
leetcode.cn 2025-06-27
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
Telegraph
longest-subsequence-repeated-k-times
给你一个长度为 n 的字符串 s ,和一个整数 k 。请你找出字符串 s 中 重复 k 次的 最长子序列 。 子序列 是由其他字符串删除某些(或不删除)字符派生而来的一个字符串。 如果 seq * k 是 s 的一个子序列,其中 seq * k 表示一个由 seq 串联 k 次构造的字符串,那么就称 seq 是字符串 s 中一个 重复 k 次 的子序列。
leetcode.com 2025-06-27
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
Telegraph
longest-subsequence-repeated-k-times
You are given a string s of length n, and an integer k. You are tasked to find the longest subsequence repeated k times in string s. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order…
leetcode.cn 2025-07-28
🟡2044.count-number-of-maximum-bitwise-or-subsets
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
🟡2044.count-number-of-maximum-bitwise-or-subsets
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
Telegraph
count-number-of-maximum-bitwise-or-subsets
给你一个整数数组 nums ,请你找出 nums 子集 按位或 可能得到的 最大值 ,并返回按位或能得到最大值的 不同非空子集的数目 。 如果数组 a 可以由数组 b 删除一些元素(或不删除)得到,则认为数组 a 是数组 b 的一个 子集 。如果选中的元素下标位置不一样,则认为两个子集 不同 。 对数组 a 执行 按位或 ,结果等于 a[0] OR a[1] OR ... OR a[a.length - 1](下标从 0 开始)。 示例 1: 输入:nums = [3,1] 输出:2 解释:子集按位或能得到的最大值是…
leetcode.com 2025-07-28
🟡2044.count-number-of-maximum-bitwise-or-subsets
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
🟡2044.count-number-of-maximum-bitwise-or-subsets
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
Telegraph
count-number-of-maximum-bitwise-or-subsets
Given an integer array nums, find the maximum possible bitwise OR of a subset of nums and return the number of different non-empty subsets with the maximum bitwise OR. An array a is a subset of an array b if a can be obtained from b by deleting some (possibly…
leetcode.cn 2025-10-24
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#hash_table #math #backtracking #counting #enumeration
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#hash_table #math #backtracking #counting #enumeration
Telegraph
next-greater-numerically-balanced-number
如果整数 x 满足:对于每个数位 d ,这个数位 恰好 在 x 中出现 d 次。那么整数 x 就是一个 数值平衡数 。 给你一个整数 n ,请你返回 严格大于 n 的 最小数值平衡数 。 示例 1: 输入:n = 1 输出:22 解释: 22 是一个数值平衡数,因为: - 数字 2 出现 2 次 这也是严格大于 1 的最小数值平衡数。 示例 2: 输入:n = 1000 输出:1333 解释: 1333 是一个数值平衡数,因为: - 数字 1 出现 1 次。 - 数字 3 出现 3 次。 这也是严格大于…
leetcode.com 2025-10-24
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#hash_table #math #backtracking #counting #enumeration
🟡2048.next-greater-numerically-balanced-number
🏷️ Tags
#hash_table #math #backtracking #counting #enumeration
Telegraph
next-greater-numerically-balanced-number
An integer x is numerically balanced if for every digit d in the number x, there are exactly d occurrences of that digit in x. Given an integer n, return the smallest numerically balanced number strictly greater than n. Example 1: Input: n = 1 Output: 22…