leetcode.cn 2023-07-20
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#queue #array #divide_and_conquer #dynamic_programming #monotonic_queue
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#queue #array #divide_and_conquer #dynamic_programming #monotonic_queue
Telegraph
maximum-sum-circular-subarray
给定一个长度为 n 的环形整数数组 nums ,返回 nums 的非空 子数组 的最大可能和 。 环形数组 意味着数组的末端将会与开头相连呈环状。形式上, nums[i] 的下一个元素是 nums[(i + 1) % n] , nums[i] 的前一个元素是 nums[(i - 1 + n) % n] 。 子数组 最多只能包含固定缓冲区 nums 中的每个元素一次。形式上,对于子数组 nums[i], nums[i + 1], ..., nums[j] ,不存在 i <= k1, k2 <= j 其中 k1…
leetcode.cn 2023-07-21
🔴1499.max-value-of-equation
🏷️ Tags
#queue #array #sliding_window #monotonic_queue #heap_priority_queue
🔴1499.max-value-of-equation
🏷️ Tags
#queue #array #sliding_window #monotonic_queue #heap_priority_queue
Telegraph
max-value-of-equation
给你一个数组 points 和一个整数 k 。数组中每个元素都表示二维平面上的点的坐标,并按照横坐标 x 的值从小到大排序。也就是说 points[i] = [xi, yi] ,并且在 1 <= i < j <= points.length 的前提下, xi < xj 总成立。 请你找出 yi + yj + |xi - xj| 的 最大值,其中 |xi - xj| <= k 且 1 <= i < j <= points.length。 题目测试数据保证至少存在一对能够满足 |xi - xj| <= k 的点。…
leetcode.com 2023-08-16
🔴239.sliding-window-maximum
🏷️ Tags
#queue #array #sliding_window #monotonic_queue #heap_priority_queue
🔴239.sliding-window-maximum
🏷️ Tags
#queue #array #sliding_window #monotonic_queue #heap_priority_queue
Telegraph
sliding-window-maximum
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return…
leetcode.com 2023-10-20
🟡341.flatten-nested-list-iterator
🏷️ Tags
#stack #tree #depth_first_search #design #queue #iterator
🟡341.flatten-nested-list-iterator
🏷️ Tags
#stack #tree #depth_first_search #design #queue #iterator
Telegraph
flatten-nested-list-iterator
You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it. Implement the NestedIterator class:
leetcode.com 2023-10-21
🔴1425.constrained-subsequence-sum
🏷️ Tags
#queue #array #dynamic_programming #sliding_window #monotonic_queue #heap_priority_queue
🔴1425.constrained-subsequence-sum
🏷️ Tags
#queue #array #dynamic_programming #sliding_window #monotonic_queue #heap_priority_queue
Telegraph
constrained-subsequence-sum
Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that array such that for every two consecutive integers in the subsequence, nums[i] and nums[j], where i < j, the condition j - i <= k is satisfied. A subsequence…
leetcode.cn 2023-11-28
🟡1670.design-front-middle-back-queue
🏷️ Tags
#design #queue #array #linked_list #data_stream
🟡1670.design-front-middle-back-queue
🏷️ Tags
#design #queue #array #linked_list #data_stream
Telegraph
design-front-middle-back-queue
请你设计一个队列,支持在前,中,后三个位置的 push 和 pop 操作。 请你完成 FrontMiddleBack 类:
leetcode.cn 2024-02-05
🟡1696.jump-game-vi
🏷️ Tags
#queue #array #dynamic_programming #monotonic_queue #heap_priority_queue
🟡1696.jump-game-vi
🏷️ Tags
#queue #array #dynamic_programming #monotonic_queue #heap_priority_queue
Telegraph
jump-game-vi
给你一个下标从 0 开始的整数数组 nums 和一个整数 k 。 一开始你在下标 0 处。每一步,你最多可以往前跳 k 步,但你不能跳出数组的边界。也就是说,你可以从下标 i 跳到 [i + 1, min(n - 1, i + k)] 包含 两个端点的任意位置。 你的目标是到达数组最后一个位置(下标为 n - 1 ),你的 得分 为经过的所有数字之和。 请你返回你能得到的 最大得分 。 示例 1: 输入:nums = [1,-1,-2,4,-7,3], k = 2 输出:7 解释:你可以选择子序列 [1…
leetcode.com 2024-02-05
🟢387.first-unique-character-in-a-string
🏷️ Tags
#queue #hash_table #string #counting
🟢387.first-unique-character-in-a-string
🏷️ Tags
#queue #hash_table #string #counting
Telegraph
first-unique-character-in-a-string
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode" Output: 0 Example 2: Input: s = "loveleetcode" Output: 2 Example 3: Input: s = "aabb" Output: -1 Constraints:
👍5❤1
leetcode.com 2025-03-19
🟡3191.minimum-operations-to-make-binary-array-elements-equal-to-one-i
🏷️ Tags
#bit_manipulation #queue #array #prefix_sum #sliding_window
🟡3191.minimum-operations-to-make-binary-array-elements-equal-to-one-i
🏷️ Tags
#bit_manipulation #queue #array #prefix_sum #sliding_window
Telegraph
minimum-operations-to-make-binary-array-elements-equal-to-one-i
You are given a binary array nums. You can do the following operation on the array any number of times (possibly zero):
leetcode.cn 2025-04-26
🔴2444.count-subarrays-with-fixed-bounds
🏷️ Tags
#queue #array #sliding_window #monotonic_queue
🔴2444.count-subarrays-with-fixed-bounds
🏷️ Tags
#queue #array #sliding_window #monotonic_queue
Telegraph
count-subarrays-with-fixed-bounds
给你一个整数数组 nums 和两个整数 minK 以及 maxK 。 nums 的定界子数组是满足下述条件的一个子数组:
leetcode.com 2025-04-26
🔴2444.count-subarrays-with-fixed-bounds
🏷️ Tags
#queue #array #sliding_window #monotonic_queue
🔴2444.count-subarrays-with-fixed-bounds
🏷️ Tags
#queue #array #sliding_window #monotonic_queue
Telegraph
count-subarrays-with-fixed-bounds
You are given an integer array nums and two integers minK and maxK. A fixed-bound subarray of nums is a subarray that satisfies the following conditions:
leetcode.cn 2025-05-01
🔴2071.maximum-number-of-tasks-you-can-assign
🏷️ Tags
#greedy #queue #array #binary_search #sorting #monotonic_queue
🔴2071.maximum-number-of-tasks-you-can-assign
🏷️ Tags
#greedy #queue #array #binary_search #sorting #monotonic_queue
Telegraph
maximum-number-of-tasks-you-can-assign
给你 n 个任务和 m 个工人。每个任务需要一定的力量值才能完成,需要的力量值保存在下标从 0 开始的整数数组 tasks 中,第 i 个任务需要 tasks[i] 的力量才能完成。每个工人的力量值保存在下标从 0 开始的整数数组 workers 中,第 j 个工人的力量值为 workers[j] 。每个工人只能完成 一个 任务,且力量值需要 大于等于 该任务的力量要求值(即 workers[j] >= tasks[i] )。 除此以外,你还有 pills 个神奇药丸,可以给 一个工人的力量值 增加 s…
leetcode.com 2025-05-01
🔴2071.maximum-number-of-tasks-you-can-assign
🏷️ Tags
#greedy #queue #array #binary_search #sorting #monotonic_queue
🔴2071.maximum-number-of-tasks-you-can-assign
🏷️ Tags
#greedy #queue #array #binary_search #sorting #monotonic_queue
Telegraph
maximum-number-of-tasks-you-can-assign
You have n tasks and m workers. Each task has a strength requirement stored in a 0-indexed integer array tasks, with the ith task requiring tasks[i] strength to complete. The strength of each worker is stored in a 0-indexed integer array workers, with the…