leetcode.com 2023-04-22
🔴1312.minimum-insertion-steps-to-make-a-string-palindrome
🏷️ Tags
#string #dynamic_programming
🔴1312.minimum-insertion-steps-to-make-a-string-palindrome
🏷️ Tags
#string #dynamic_programming
Telegraph
minimum-insertion-steps-to-make-a-string-palindrome
Given a string s. In one step you can insert any character at any index of the string. Return the minimum number of steps to make s palindrome. A Palindrome String is one that reads the same backward as well as forward. Example 1: Input: s = "zzazz" Output:…
leetcode.com 2023-04-25
🟡2336.smallest-number-in-infinite-set
🏷️ Tags
#design #hash_table #heap_priority_queue
🟡2336.smallest-number-in-infinite-set
🏷️ Tags
#design #hash_table #heap_priority_queue
Telegraph
smallest-number-in-infinite-set
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...]. Implement the SmallestInfiniteSet class:
leetcode.cn 2023-04-26
🟡1031.maximum-sum-of-two-non-overlapping-subarrays
🏷️ Tags
#array #dynamic_programming #sliding_window
🟡1031.maximum-sum-of-two-non-overlapping-subarrays
🏷️ Tags
#array #dynamic_programming #sliding_window
Telegraph
maximum-sum-of-two-non-overlapping-subarrays
给你一个整数数组 nums 和两个整数 firstLen 和 secondLen,请你找出并返回两个非重叠 子数组 中元素的最大和,长度分别为 firstLen 和 secondLen 。 长度为 firstLen 的子数组可以出现在长为 secondLen 的子数组之前或之后,但二者必须是不重叠的。 子数组是数组的一个 连续 部分。 示例 1: 输入:nums = [0,6,5,2,2,5,1,9,4], firstLen = 1, secondLen = 2 输出:20 解释:子数组的一种选择中,[9]…
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:…