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…
leetcode.cn 2026-03-07
🟡1888.minimum-number-of-flips-to-make-the-binary-string-alternating
🏷️ Tags
#string #dynamic_programming #sliding_window
🟡1888.minimum-number-of-flips-to-make-the-binary-string-alternating
🏷️ Tags
#string #dynamic_programming #sliding_window
Telegraph
minimum-number-of-flips-to-make-the-binary-string-alternating
给你一个二进制字符串 s 。你可以按任意顺序执行以下两种操作任意次:
leetcode.com 2026-03-07
🟡1888.minimum-number-of-flips-to-make-the-binary-string-alternating
🏷️ Tags
#string #dynamic_programming #sliding_window
🟡1888.minimum-number-of-flips-to-make-the-binary-string-alternating
🏷️ Tags
#string #dynamic_programming #sliding_window
Telegraph
minimum-number-of-flips-to-make-the-binary-string-alternating
You are given a binary string s. You are allowed to perform two types of operations on the string in any sequence: