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-24
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
Telegraph
longest-subarray-of-1s-after-deleting-one-element
给你一个二进制数组 nums ,你需要从中删掉一个元素。 请你在删掉元素的结果数组中,返回最长的且只包含 1 的非空子数组的长度。 如果不存在这样的子数组,请返回 0 。 提示 1: 输入:nums = [1,1,0,1] 输出:3 解释:删掉位置 2 的数后,[1,1,1] 包含 3 个 1 。 示例 2: 输入:nums = [0,1,1,1,0,1,1,0,1] 输出:5 解释:删掉位置 4 的数字后,[0,1,1,1,1,1,0,1] 的最长全 1 子数组为 [1,1,1,1,1] 。 示例…
leetcode.com 2025-08-24
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
Telegraph
longest-subarray-of-1s-after-deleting-one-element
Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1's in the resulting array. Return 0 if there is no such subarray. Example 1: Input: nums = [1,1,0,1] Output: 3 Explanation:…
leetcode.cn 2025-10-21
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-i
给你一个整数数组 nums 和两个整数 k 和 numOperations 。 你必须对 nums 执行 操作 numOperations 次。每次操作中,你可以:
leetcode.com 2025-10-21
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-i
You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you:
leetcode.cn 2025-10-22
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-ii
给你一个整数数组 nums 和两个整数 k 和 numOperations 。 你必须对 nums 执行 操作 numOperations 次。每次操作中,你可以:
leetcode.com 2025-10-22
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-ii
You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you:
leetcode.cn 2025-11-04
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-i
给你一个由 n 个整数组成的数组 nums,以及两个整数 k 和 x。 数组的 x-sum 计算按照以下步骤进行:
leetcode.com 2025-11-04
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-i
You are given an array nums of n integers and two integers k and x. The x-sum of an array is calculated by the following procedure:
leetcode.cn 2025-11-05
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-ii
给你一个由 n 个整数组成的数组 nums,以及两个整数 k 和 x。 数组的 x-sum 计算按照以下步骤进行:
leetcode.com 2025-11-05
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-ii
You are given an array nums of n integers and two integers k and x. The x-sum of an array is calculated by the following procedure:
leetcode.cn 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
给你一个下标从 0 开始长度为 n 的整数数组 stations ,其中 stations[i] 表示第 i 座城市的供电站数目。 每个供电站可以在一定 范围 内给所有城市提供电力。换句话说,如果给定的范围是 r ,在城市 i 处的供电站可以给所有满足 |i - j| <= r 且 0 <= i, j <= n - 1 的城市 j 供电。
leetcode.com 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
You are given a 0-indexed integer array stations of length n, where stations[i] represents the number of power stations in the ith city. Each power station can provide power to every city in a fixed range. In other words, if the range is denoted by r, then…
leetcode.cn 2025-11-15
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
Telegraph
count-the-number-of-substrings-with-dominant-ones
给你一个二进制字符串 s。 请你统计并返回其中 1 显著 的 子字符串 的数量。 如果字符串中 1 的数量 大于或等于 0 的数量的 平方,则认为该字符串是一个 1 显著 的字符串 。 示例 1: 输入:s = "00011" 输出:5 解释: 1 显著的子字符串如下表所示。
leetcode.com 2025-11-15
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
Telegraph
count-the-number-of-substrings-with-dominant-ones
You are given a binary string s. Return the number of substrings with dominant ones. A string has dominant ones if the number of ones in the string is greater than or equal to the square of the number of zeros in the string. Example 1: Input: s = "00011"…
leetcode.cn 2025-12-06
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
Telegraph
count-partitions-with-max-min-difference-at-most-k
给你一个整数数组 nums 和一个整数 k。你的任务是将 nums 分割成一个或多个 非空 的连续子段,使得每个子段的 最大值 与 最小值 之间的差值 不超过 k。
leetcode.com 2025-12-06
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
Telegraph
count-partitions-with-max-min-difference-at-most-k
You are given an integer array nums and an integer k. Your task is to partition nums into one or more non-empty contiguous segments such that in each segment, the difference between its maximum and minimum elements is at most k. Return the total number of…
leetcode.cn 2025-12-18
🟡3652.best-time-to-buy-and-sell-stock-using-strategy
🏷️ Tags
#array #prefix_sum #sliding_window
🟡3652.best-time-to-buy-and-sell-stock-using-strategy
🏷️ Tags
#array #prefix_sum #sliding_window
Telegraph
best-time-to-buy-and-sell-stock-using-strategy
给你两个整数数组 prices 和 strategy,其中: