leetcode.cn 2023-04-28
🔴1172.dinner-plate-stacks
🏷️ Tags
#stack #design #hash_table #heap_priority_queue
🔴1172.dinner-plate-stacks
🏷️ Tags
#stack #design #hash_table #heap_priority_queue
Telegraph
dinner-plate-stacks
我们把无限数量 ∞ 的栈排成一行,按从左到右的次序从 0 开始编号。每个栈的的最大容量 capacity 都相同。 实现一个叫「餐盘」的类 DinnerPlates:
leetcode.com 2023-04-28
🔴839.similar-string-groups
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #string
🔴839.similar-string-groups
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #string
Telegraph
similar-string-groups
Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. Also two strings X and Y are similar if they are equal. For example, "tars" and "rats" are similar (swapping at positions 0 and 2), and "rats" and…
leetcode.com 2023-04-29
🔴1697.checking-existence-of-edge-length-limited-paths
🏷️ Tags
#union_find #graph #array #sorting
🔴1697.checking-existence-of-edge-length-limited-paths
🏷️ Tags
#union_find #graph #array #sorting
Telegraph
checking-existence-of-edge-length-limited-paths
An undirected graph of n nodes is defined by edgeList, where edgeList[i] = [ui, vi, disi] denotes an edge between nodes ui and vi with distance disi. Note that there may be multiple edges between two nodes. Given an array queries, where queries[j] = [pj,…
leetcode.com 2023-04-30
🔴1579.remove-max-number-of-edges-to-keep-graph-fully-traversable
🏷️ Tags
#union_find #graph
🔴1579.remove-max-number-of-edges-to-keep-graph-fully-traversable
🏷️ Tags
#union_find #graph
Telegraph
remove-max-number-of-edges-to-keep-graph-fully-traversable
Alice and Bob have an undirected graph of n nodes and three types of edges:
leetcode.cn 2023-05-01
🟡1376.time-needed-to-inform-all-employees
🏷️ Tags
#tree #depth_first_search #breadth_first_search
🟡1376.time-needed-to-inform-all-employees
🏷️ Tags
#tree #depth_first_search #breadth_first_search
Telegraph
time-needed-to-inform-all-employees
公司里有 n 名员工,每个员工的 ID 都是独一无二的,编号从 0 到 n - 1。公司的总负责人通过 headID 进行标识。 在 manager 数组中,每个员工都有一个直属负责人,其中 manager[i] 是第 i 名员工的直属负责人。对于总负责人,manager[headID] = -1。题目保证从属关系可以用树结构显示。 公司总负责人想要向公司所有员工通告一条紧急消息。他将会首先通知他的直属下属们,然后由这些下属通知他们的下属,直到所有的员工都得知这条紧急消息。 第 i 名员工需要 informTime[i]…
leetcode.com 2023-05-01
🟢1491.average-salary-excluding-the-minimum-and-maximum-salary
🏷️ Tags
#array #sorting
🟢1491.average-salary-excluding-the-minimum-and-maximum-salary
🏷️ Tags
#array #sorting
Telegraph
average-salary-excluding-the-minimum-and-maximum-salary
You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding the minimum and maximum salary. Answers within 10-5 of the actual answer will be accepted. Example 1: Input:…
leetcode.cn 2023-05-04
🔴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 2023-05-05
🟡1456.maximum-number-of-vowels-in-a-substring-of-given-length
🏷️ Tags
#string #sliding_window
🟡1456.maximum-number-of-vowels-in-a-substring-of-given-length
🏷️ Tags
#string #sliding_window
Telegraph
maximum-number-of-vowels-in-a-substring-of-given-length
Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k. Vowel letters in English are 'a', 'e', 'i', 'o', and 'u'. Example 1: Input: s = "abciiidef", k = 3 Output: 3 Explanation: The substring "iii"…
leetcode.com 2023-05-06
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
number-of-subsequences-that-satisfy-the-given-sum-condition
You are given an array of integers nums and an integer target. Return the number of non-empty subsequences of nums such that the sum of the minimum and maximum element on it is less or equal to target. Since the answer may be too large, return it modulo 109…
leetcode.cn 2023-05-07
🟡1010.pairs-of-songs-with-total-durations-divisible-by-60
🏷️ Tags
#array #hash_table #counting
🟡1010.pairs-of-songs-with-total-durations-divisible-by-60
🏷️ Tags
#array #hash_table #counting
Telegraph
pairs-of-songs-with-total-durations-divisible-by-60
在歌曲列表中,第 i 首歌曲的持续时间为 time[i] 秒。 返回其总持续时间(以秒为单位)可被 60 整除的歌曲对的数量。形式上,我们希望下标数字 i 和 j 满足 i < j 且有 (time[i] + time[j]) % 60 == 0。 示例 1: 输入:time = [30,20,150,100,40] 输出:3 解释:这三对的总持续时间可被 60 整除: (time[0] = 30, time[2] = 150): 总持续时间 180 (time[1] = 20, time[3] =…