leetcode.cn 2026-02-23
🟡1461.check-if-a-string-contains-all-binary-codes-of-size-k
🏷️ Tags
#bit_manipulation #hash_table #string #hash_function #rolling_hash
🟡1461.check-if-a-string-contains-all-binary-codes-of-size-k
🏷️ Tags
#bit_manipulation #hash_table #string #hash_function #rolling_hash
Telegraph
check-if-a-string-contains-all-binary-codes-of-size-k
给你一个二进制字符串 s 和一个整数 k 。如果所有长度为 k 的二进制字符串都是 s 的子串,请返回 true ,否则请返回 false 。 示例 1: 输入:s = "00110110", k = 2 输出:true 解释:长度为 2 的二进制串包括 "00","01","10" 和 "11"。它们分别是 s 中下标为 0,1,3,2 开始的长度为 2 的子串。 示例 2: 输入:s = "0110", k = 1 输出:true 解释:长度为 1 的二进制串包括 "0" 和 "1",显然它们都是…
leetcode.com 2026-02-23
🟡1461.check-if-a-string-contains-all-binary-codes-of-size-k
🏷️ Tags
#bit_manipulation #hash_table #string #hash_function #rolling_hash
🟡1461.check-if-a-string-contains-all-binary-codes-of-size-k
🏷️ Tags
#bit_manipulation #hash_table #string #hash_function #rolling_hash
Telegraph
check-if-a-string-contains-all-binary-codes-of-size-k
Given a binary string s and an integer k, return true if every binary code of length k is a substring of s. Otherwise, return false. Example 1: Input: s = "00110110", k = 2 Output: true Explanation: The binary codes of length 2 are "00", "01", "10" and…
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.
leetcode.cn 2026-02-25
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
Telegraph
sort-integers-by-the-number-of-1-bits
给你一个整数数组 arr 。请你将数组中的元素按照其二进制表示中数字 1 的数目升序排序。 如果存在多个数字二进制中 1 的数目相同,则必须将它们按照数值大小升序排列。 请你返回排序后的数组。 示例 1: 输入:arr = [0,1,2,3,4,5,6,7,8] 输出:[0,1,2,4,8,3,5,6,7] 解释:[0] 是唯一一个有 0 个 1 的数。 [1,2,4,8] 都有 1 个 1 。 [3,5,6] 有 2 个 1 。 [7] 有 3 个 1 。 按照 1 的个数排序得到的结果数组为 [0…
leetcode.com 2026-02-25
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
Telegraph
sort-integers-by-the-number-of-1-bits
You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order. Return the…
leetcode.cn 2026-02-26
🟡1404.number-of-steps-to-reduce-a-number-in-binary-representation-to-one
🏷️ Tags
#bit_manipulation #string #simulation
🟡1404.number-of-steps-to-reduce-a-number-in-binary-representation-to-one
🏷️ Tags
#bit_manipulation #string #simulation
Telegraph
number-of-steps-to-reduce-a-number-in-binary-representation-to-one
给你一个以二进制形式表示的数字 s 。请你返回按下述规则将其减少到 1 所需要的步骤数:
leetcode.com 2026-02-26
🟡1404.number-of-steps-to-reduce-a-number-in-binary-representation-to-one
🏷️ Tags
#bit_manipulation #string #simulation
🟡1404.number-of-steps-to-reduce-a-number-in-binary-representation-to-one
🏷️ Tags
#bit_manipulation #string #simulation
Telegraph
number-of-steps-to-reduce-a-number-in-binary-representation-to-one
Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules:
leetcode.cn 2026-02-27
🔴3666.minimum-operations-to-equalize-binary-string
🏷️ Tags
#breadth_first_search #union_find #math #string #ordered_set
🔴3666.minimum-operations-to-equalize-binary-string
🏷️ Tags
#breadth_first_search #union_find #math #string #ordered_set
Telegraph
minimum-operations-to-equalize-binary-string
给你一个二进制字符串 s 和一个整数 k。
leetcode.cn 2026-02-28
🟡1680.concatenation-of-consecutive-binary-numbers
🏷️ Tags
#bit_manipulation #math #simulation
🟡1680.concatenation-of-consecutive-binary-numbers
🏷️ Tags
#bit_manipulation #math #simulation
Telegraph
concatenation-of-consecutive-binary-numbers
给你一个整数 n ,请你将 1 到 n 的二进制表示连接起来,并返回连接结果对应的 十进制 数字对 109 + 7 取余的结果。 示例 1: 输入:n = 1 输出:1 解释:二进制的 "1" 对应着十进制的 1 。 示例 2: 输入:n = 3 输出:27 解释:二进制下,1,2 和 3 分别对应 "1" ,"10" 和 "11" 。 将它们依次连接,我们得到 "11011" ,对应着十进制的 27 。 示例 3: 输入:n = 12 输出:505379714 解释:连接结果为 "11011100…
leetcode.com 2026-02-28
🟡1680.concatenation-of-consecutive-binary-numbers
🏷️ Tags
#bit_manipulation #math #simulation
🟡1680.concatenation-of-consecutive-binary-numbers
🏷️ Tags
#bit_manipulation #math #simulation
Telegraph
concatenation-of-consecutive-binary-numbers
Given an integer n, return the decimal value of the binary string formed by concatenating the binary representations of 1 to n in order, modulo 109 + 7. Example 1: Input: n = 1 Output: 1 Explanation: "1" in binary corresponds to the decimal value 1. Example…
leetcode.cn 2026-03-01
🟡1689.partitioning-into-minimum-number-of-deci-binary-numbers
🏷️ Tags
#greedy #string
🟡1689.partitioning-into-minimum-number-of-deci-binary-numbers
🏷️ Tags
#greedy #string
Telegraph
partitioning-into-minimum-number-of-deci-binary-numbers
如果一个十进制数字不含任何前导零,且每一位上的数字不是 0 就是 1 ,那么该数字就是一个 十-二进制数 。例如,101 和 1100 都是 十-二进制数,而 112 和 3001 不是。 给你一个表示十进制整数的字符串 n ,返回和为 n 的 十-二进制数 的最少数目。 示例 1: 输入:n = "32" 输出:3 解释:10 + 11 + 11 = 32 示例 2: 输入:n = "82734" 输出:8 示例 3: 输入:n = "27346209830709182346" 输出:9 提示:
leetcode.com 2026-03-01
🟡1689.partitioning-into-minimum-number-of-deci-binary-numbers
🏷️ Tags
#greedy #string
🟡1689.partitioning-into-minimum-number-of-deci-binary-numbers
🏷️ Tags
#greedy #string
Telegraph
partitioning-into-minimum-number-of-deci-binary-numbers
A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not. Given a string n that represents a positive decimal integer, return the minimum…