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…
leetcode.cn 2025-09-09
🟡2327.number-of-people-aware-of-a-secret
🏷️ Tags
#queue #dynamic_programming #simulation
🟡2327.number-of-people-aware-of-a-secret
🏷️ Tags
#queue #dynamic_programming #simulation
Telegraph
number-of-people-aware-of-a-secret
在第 1 天,有一个人发现了一个秘密。 给你一个整数 delay ,表示每个人会在发现秘密后的 delay 天之后,每天 给一个新的人 分享 秘密。同时给你一个整数 forget ,表示每个人在发现秘密 forget 天之后会 忘记 这个秘密。一个人 不能 在忘记秘密那一天及之后的日子里分享秘密。 给你一个整数 n ,请你返回在第 n 天结束时,知道秘密的人数。由于答案可能会很大,请你将结果对 109 + 7 取余 后返回。 示例 1: 输入:n = 6, delay = 2, forget = 4…
leetcode.com 2025-09-09
🟡2327.number-of-people-aware-of-a-secret
🏷️ Tags
#queue #dynamic_programming #simulation
🟡2327.number-of-people-aware-of-a-secret
🏷️ Tags
#queue #dynamic_programming #simulation
Telegraph
number-of-people-aware-of-a-secret
On day 1, one person discovers a secret. You are given an integer delay, which means that each person will share the secret with a new person every day, starting from delay days after discovering the secret. You are also given an integer forget, which means…
leetcode.cn 2025-09-20
🟡3508.implement-router
🏷️ Tags
#design #queue #array #hash_table #binary_search #ordered_set
🟡3508.implement-router
🏷️ Tags
#design #queue #array #hash_table #binary_search #ordered_set
Telegraph
implement-router
请你设计一个数据结构来高效管理网络路由器中的数据包。每个数据包包含以下属性:
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-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…