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…
leetcode.cn 2025-08-21
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
count-submatrices-with-all-ones
给你一个 m x n 的二进制矩阵 mat ,请你返回有多少个 子矩形 的元素全部都是 1 。 示例 1: 输入:mat = [[1,0,1],[1,1,0],[1,1,0]] 输出:13 解释:有 6 个 1x1 的矩形。 有 2 个 1x2 的矩形。 有 3 个 2x1 的矩形。 有 1 个 2x2 的矩形。 有 1 个 3x1 的矩形。 矩形数目总共 = 6 + 2 + 3 + 1 + 1 = 13 。 示例 2: 输入:mat = [[0,1,1,0],[0,1,1,1],[1,1,1,0]]…
leetcode.com 2025-08-21
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
count-submatrices-with-all-ones
Given an m x n binary matrix mat, return the number of submatrices that have all ones. Example 1: Input: mat = [[1,0,1],[1,1,0],[1,1,0]] Output: 13 Explanation: There are 6 rectangles of side 1x1. There are 2 rectangles of side 1x2. There are 3 rectangles…