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…