leetcode.cn 2026-10-19
🟢2089.find-target-indices-after-sorting-array
🏷️ Tags
#array #binary_search #sorting
🟢2089.find-target-indices-after-sorting-array
🏷️ Tags
#array #binary_search #sorting
Telegraph
find-target-indices-after-sorting-array
给你一个下标从 0 开始的整数数组 nums 以及一个目标元素 target 。 目标下标 是一个满足 nums[i] == target 的下标 i 。 将 nums 按 非递减 顺序排序后,返回由 nums 中目标下标组成的列表。如果不存在目标下标,返回一个 空 列表。返回的列表必须按 递增 顺序排列。 示例 1: 输入:nums = [1,2,5,2,3], target = 2 输出:[1,2] 解释:排序后,nums 变为 [1,2,2,3,5] 。 满足 nums[i] == 2 的下标是…
leetcode.com 2026-10-19
🟢2089.find-target-indices-after-sorting-array
🏷️ Tags
#array #binary_search #sorting
🟢2089.find-target-indices-after-sorting-array
🏷️ Tags
#array #binary_search #sorting
Telegraph
find-target-indices-after-sorting-array
You are given a 0-indexed integer array nums and a target element target. A target index is an index i such that nums[i] == target. Return a list of the target indices of nums after sorting nums in non-decreasing order. If there are no target indices, return…
leetcode.cn 2026-11-05
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
find-the-distance-value-between-two-arrays
给你两个整数数组 arr1 , arr2 和一个整数 d ,请你返回两个数组之间的 距离值 。 「距离值」 定义为符合此距离要求的元素数目:对于元素 arr1[i] ,不存在任何元素 arr2[j] 满足 |arr1[i]-arr2[j]| <= d 。 示例 1: 输入:arr1 = [4,5,8], arr2 = [10,9,1,8], d = 2 输出:2 解释: 对于 arr1[0]=4 我们有: |4-10|=6 > d=2 |4-9|=5 > d=2 |4-1|=3 > d=2 |4-8|=4…
leetcode.com 2026-11-05
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
find-the-distance-value-between-two-arrays
Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements arr1[i] such that there is not any element arr2[j] where |arr1[i]-arr2[j]| <= d. Example…
leetcode.cn 2026-11-06
🟡2747.count-zero-request-servers
🏷️ Tags
#array #hash_table #sorting #sliding_window
🟡2747.count-zero-request-servers
🏷️ Tags
#array #hash_table #sorting #sliding_window
Telegraph
count-zero-request-servers
给你一个整数 n ,表示服务器的总数目,再给你一个下标从 0 开始的 二维 整数数组 logs ,其中 logs[i] = [server_id, time] 表示 id 为 server_id 的服务器在 time 时收到了一个请求。 同时给你一个整数 x 和一个下标从 0 开始的整数数组 queries 。 请你返回一个长度等于 queries.length 的数组 arr ,其中 arr[i] 表示在时间区间 [queries[i] - x, queries[i]] 内没有收到请求的服务器数目。…
leetcode.com 2026-11-06
🟡2747.count-zero-request-servers
🏷️ Tags
#array #hash_table #sorting #sliding_window
🟡2747.count-zero-request-servers
🏷️ Tags
#array #hash_table #sorting #sliding_window
Telegraph
count-zero-request-servers
You are given an integer n denoting the total number of servers and a 2D 0-indexed integer array logs, where logs[i] = [server_id, time] denotes that the server with id server_id received a request at time time. You are also given an integer x and a 0-indexed…
leetcode.cn 2026-11-20
🔴3041.maximize-consecutive-elements-in-an-array-after-modification
🏷️ Tags
#array #dynamic_programming #sorting
🔴3041.maximize-consecutive-elements-in-an-array-after-modification
🏷️ Tags
#array #dynamic_programming #sorting
Telegraph
maximize-consecutive-elements-in-an-array-after-modification
给你一个下标从 0 开始只包含 正 整数的数组 nums 。 一开始,你可以将数组中 任意数量 元素增加 至多 1 。 修改后,你可以从最终数组中选择 一个或者更多 元素,并确保这些元素升序排序后是 连续 的。比方说,[3, 4, 5] 是连续的,但是 [3, 4, 6] 和 [1, 1, 2, 3] 不是连续的。 请你返回 最多 可以选出的元素数目。 示例 1: 输入:nums = [2,1,5,1,1] 输出:3 解释:我们将下标 0 和 3 处的元素增加 1 ,得到结果数组 nums = [3…
leetcode.com 2026-11-20
🔴3041.maximize-consecutive-elements-in-an-array-after-modification
🏷️ Tags
#array #dynamic_programming #sorting
🔴3041.maximize-consecutive-elements-in-an-array-after-modification
🏷️ Tags
#array #dynamic_programming #sorting
Telegraph
maximize-consecutive-elements-in-an-array-after-modification
You are given a 0-indexed array nums consisting of positive integers. Initially, you can increase the value of any element in the array by at most 1. After that, you need to select one or more elements from the final array such that those elements are consecutive…
leetcode.cn 2026-11-28
🟡3947.maximum-number-of-items-from-sale-ii
🏷️ Tags
#greedy #array #sorting #heap_priority_queue
🟡3947.maximum-number-of-items-from-sale-ii
🏷️ Tags
#greedy #array #sorting #heap_priority_queue
Telegraph
maximum-number-of-items-from-sale-ii
给你一个二维整数数组 items,其中 items[i] = [factori, pricei] 表示下标为 i 的物品。同时给你一个整数 budget。 每种物品都有无限个可供购买。你可以购买任意数量的任意物品,但购买物品的总花费最多为 budget。 购买物品后,你可以根据以下规则获得免费的物品:
leetcode.com 2026-11-28
🟡3947.maximum-number-of-items-from-sale-ii
🏷️ Tags
#greedy #array #sorting #heap_priority_queue
🟡3947.maximum-number-of-items-from-sale-ii
🏷️ Tags
#greedy #array #sorting #heap_priority_queue
Telegraph
maximum-number-of-items-from-sale-ii
You are given a 2D integer array items, where items[i] = [factori, pricei] represents the ith item. You are also given an integer budget. There are unlimited copies of each item available for purchase. You may buy any number of copies of any items such that…
leetcode.cn 2026-12-02
🟡1202.smallest-string-with-swaps
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #hash_table #string #sorting
🟡1202.smallest-string-with-swaps
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #hash_table #string #sorting
Telegraph
smallest-string-with-swaps
给你一个字符串 s,以及该字符串中的一些「索引对」数组 pairs,其中 pairs[i] = [a, b] 表示字符串中的两个索引(编号从 0 开始)。 你可以 任意多次交换 在 pairs 中任意一对索引处的字符。 返回在经过若干次交换后,s 可以变成的按字典序最小的字符串。 示例 1: 输入:s = "dcab", pairs = [[0,3],[1,2]] 输出:"bacd" 解释: 交换 s[0] 和 s[3], s = "bcad" 交换 s[1] 和 s[2], s = "bacd" 示例…