leetcode.cn 2025-08-03
🔴2106.maximum-fruits-harvested-after-at-most-k-steps
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
🔴2106.maximum-fruits-harvested-after-at-most-k-steps
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
Telegraph
maximum-fruits-harvested-after-at-most-k-steps
在一个无限的 x 坐标轴上,有许多水果分布在其中某些位置。给你一个二维整数数组 fruits ,其中 fruits[i] = [positioni, amounti] 表示共有 amounti 个水果放置在 positioni 上。fruits 已经按 positioni 升序排列 ,每个 positioni 互不相同 。 另给你两个整数 startPos 和 k 。最初,你位于 startPos 。从任何位置,你可以选择 向左或者向右 走。在 x 轴上每移动 一个单位 ,就记作 一步 。你总共可以走 最多…
leetcode.com 2025-08-03
🔴2106.maximum-fruits-harvested-after-at-most-k-steps
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
🔴2106.maximum-fruits-harvested-after-at-most-k-steps
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
Telegraph
maximum-fruits-harvested-after-at-most-k-steps
Fruits are available at some positions on an infinite x-axis. You are given a 2D integer array fruits where fruits[i] = [positioni, amounti] depicts amounti fruits at the position positioni. fruits is already sorted by positioni in ascending order, and each…
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: