leetcode.com 2025-08-10
🟡869.reordered-power-of-2
🏷️ Tags
#hash_table #math #counting #enumeration #sorting
🟡869.reordered-power-of-2
🏷️ Tags
#hash_table #math #counting #enumeration #sorting
Telegraph
reordered-power-of-2
You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero. Return true if and only if we can do this so that the resulting number is a power of two. Example 1: Input: n = 1 Output:…
leetcode.cn 2025-08-11
🟡2438.range-product-queries-of-powers
🏷️ Tags
#bit_manipulation #array #prefix_sum
🟡2438.range-product-queries-of-powers
🏷️ Tags
#bit_manipulation #array #prefix_sum
Telegraph
range-product-queries-of-powers
给你一个正整数 n ,你需要找到一个下标从 0 开始的数组 powers ,它包含 最少 数目的 2 的幂,且它们的和为 n 。powers 数组是 非递减 顺序的。根据前面描述,构造 powers 数组的方法是唯一的。 同时给你一个下标从 0 开始的二维整数数组 queries ,其中 queries[i] = [lefti, righti] ,其中 queries[i] 表示请你求出满足 lefti <= j <= righti 的所有 powers[j] 的乘积。 请你返回一个数组 answers…
leetcode.com 2025-08-11
🟡2438.range-product-queries-of-powers
🏷️ Tags
#bit_manipulation #array #prefix_sum
🟡2438.range-product-queries-of-powers
🏷️ Tags
#bit_manipulation #array #prefix_sum
Telegraph
range-product-queries-of-powers
Given a positive integer n, there exists a 0-indexed array called powers, composed of the minimum number of powers of 2 that sum to n. The array is sorted in non-decreasing order, and there is only one way to form the array. You are also given a 0-indexed…
leetcode.cn 2025-08-17
🟡837.new-21-game
🏷️ Tags
#math #dynamic_programming #sliding_window #probability_and_statistics
🟡837.new-21-game
🏷️ Tags
#math #dynamic_programming #sliding_window #probability_and_statistics
Telegraph
new-21-game
爱丽丝参与一个大致基于纸牌游戏 “21点” 规则的游戏,描述如下: 爱丽丝以 0 分开始,并在她的得分少于 k 分时抽取数字。 抽取时,她从 [1, maxPts] 的范围中随机获得一个整数作为分数进行累计,其中 maxPts 是一个整数。 每次抽取都是独立的,其结果具有相同的概率。 当爱丽丝获得 k 分 或更多分 时,她就停止抽取数字。 爱丽丝的分数不超过 n 的概率是多少? 与实际答案误差不超过 10-5 的答案将被视为正确答案。
leetcode.com 2025-08-17
🟡837.new-21-game
🏷️ Tags
#math #dynamic_programming #sliding_window #probability_and_statistics
🟡837.new-21-game
🏷️ Tags
#math #dynamic_programming #sliding_window #probability_and_statistics
Telegraph
new-21-game
Alice plays the following game, loosely based on the card game "21". Alice starts with 0 points and draws numbers while she has less than k points. During each draw, she gains an integer number of points randomly from the range [1, maxPts], where maxPts is…
leetcode.cn 2025-08-20
🟡1277.count-square-submatrices-with-all-ones
🏷️ Tags
#array #dynamic_programming #matrix
🟡1277.count-square-submatrices-with-all-ones
🏷️ Tags
#array #dynamic_programming #matrix
Telegraph
count-square-submatrices-with-all-ones
给你一个 m * n 的矩阵,矩阵中的元素不是 0 就是 1,请你统计并返回其中完全由 1 组成的 正方形 子矩阵的个数。 示例 1: 输入:matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] ] 输出:15 解释: 边长为 1 的正方形有 10 个。 边长为 2 的正方形有 4 个。 边长为 3 的正方形有 1 个。 正方形的总数 = 10 + 4 + 1 = 15. 示例 2: 输入:matrix = [ [1,0,1], [1,1,0], [1,1…
leetcode.com 2025-08-20
🟡1277.count-square-submatrices-with-all-ones
🏷️ Tags
#array #dynamic_programming #matrix
🟡1277.count-square-submatrices-with-all-ones
🏷️ Tags
#array #dynamic_programming #matrix
Telegraph
count-square-submatrices-with-all-ones
Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] ] Output: 15 Explanation: There are 10 squares of side 1. There are 4 squares of side 2. There is…