leetcode.com 2026-06-28
🟡1846.maximum-element-after-decreasing-and-rearranging
🏷️ Tags
#greedy #array #sorting
🟡1846.maximum-element-after-decreasing-and-rearranging
🏷️ Tags
#greedy #array #sorting
Telegraph
maximum-element-after-decreasing-and-rearranging
You are given an array of positive integers arr. Perform some operations (possibly none) on arr so that it satisfies these conditions:
leetcode.cn 2026-06-29
🟢1967.number-of-strings-that-appear-as-substrings-in-word
🏷️ Tags
#array #string
🟢1967.number-of-strings-that-appear-as-substrings-in-word
🏷️ Tags
#array #string
Telegraph
number-of-strings-that-appear-as-substrings-in-word
给你一个字符串数组 patterns 和一个字符串 word ,统计 patterns 中有多少个字符串是 word 的子字符串。返回字符串数目。 子字符串 是字符串中的一个连续字符序列。 示例 1: 输入:patterns = ["a","abc","bc","d"], word = "abc" 输出:3 解释: - "a" 是 "abc" 的子字符串。 - "abc" 是 "abc" 的子字符串。 - "bc" 是 "abc" 的子字符串。 - "d" 不是 "abc" 的子字符串。 patterns…
leetcode.com 2026-06-29
🟢1967.number-of-strings-that-appear-as-substrings-in-word
🏷️ Tags
#array #string
🟢1967.number-of-strings-that-appear-as-substrings-in-word
🏷️ Tags
#array #string
Telegraph
number-of-strings-that-appear-as-substrings-in-word
Given an array of strings patterns and a string word, return the number of strings in patterns that exist as a substring in word. A substring is a contiguous sequence of characters within a string. Example 1: Input: patterns = ["a","abc","bc","d"], word…
leetcode.cn 2026-06-30
🟡1358.number-of-substrings-containing-all-three-characters
🏷️ Tags
#hash_table #string #sliding_window
🟡1358.number-of-substrings-containing-all-three-characters
🏷️ Tags
#hash_table #string #sliding_window
Telegraph
number-of-substrings-containing-all-three-characters
给你一个字符串 s ,它只包含三种字符 a, b 和 c 。 请你返回 a,b 和 c 都 至少 出现过一次的子字符串数目。 示例 1: 输入:s = "abcabc" 输出:10 解释:包含 a,b 和 c 各至少一次的子字符串为 "abc", "abca", "abcab", "abcabc", "bca", "bcab", "bcabc", "cab", "cabc" 和 "abc" (相同字符串算多次)。 示例 2: 输入:s = "aaacb" 输出:3 解释:包含 a,b 和 c 各至少一次的子字符串为…
leetcode.com 2026-06-30
🟡1358.number-of-substrings-containing-all-three-characters
🏷️ Tags
#hash_table #string #sliding_window
🟡1358.number-of-substrings-containing-all-three-characters
🏷️ Tags
#hash_table #string #sliding_window
Telegraph
number-of-substrings-containing-all-three-characters
Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters a, b and c. Example 1: Input: s = "abcabc" Output: 10 Explanation: The substrings containing at least one…
leetcode.cn 2026-07-01
🟡2812.find-the-safest-path-in-a-grid
🏷️ Tags
#breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
🟡2812.find-the-safest-path-in-a-grid
🏷️ Tags
#breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
Telegraph
find-the-safest-path-in-a-grid
给你一个下标从 0 开始、大小为 n x n 的二维矩阵 grid ,其中 (r, c) 表示:
leetcode.com 2026-07-01
🟡2812.find-the-safest-path-in-a-grid
🏷️ Tags
#breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
🟡2812.find-the-safest-path-in-a-grid
🏷️ Tags
#breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
Telegraph
find-the-safest-path-in-a-grid
You are given a 0-indexed 2D matrix grid of size n x n, where (r, c) represents:
leetcode.cn 2026-07-02
🟡3286.find-a-safe-walk-through-a-grid
🏷️ Tags
#breadth_first_search #graph #array #matrix #shortest_path #heap_priority_queue
🟡3286.find-a-safe-walk-through-a-grid
🏷️ Tags
#breadth_first_search #graph #array #matrix #shortest_path #heap_priority_queue
Telegraph
find-a-safe-walk-through-a-grid
给你一个 m x n 的二进制矩形 grid 和一个整数 health 表示你的健康值。 你开始于矩形的左上角 (0, 0) ,你的目标是矩形的右下角 (m - 1, n - 1) 。 你可以在矩形中往上下左右相邻格子移动,但前提是你的健康值始终是 正数 。 对于格子 (i, j) ,如果 grid[i][j] = 1 ,那么这个格子视为 不安全 的,会使你的健康值减少 1 。 如果你可以到达最终的格子,请你返回 true ,否则返回 false 。 注意 ,当你在最终格子的时候,你的健康值也必须为 正数 。…
leetcode.com 2026-07-02
🟡3286.find-a-safe-walk-through-a-grid
🏷️ Tags
#breadth_first_search #graph #array #matrix #shortest_path #heap_priority_queue
🟡3286.find-a-safe-walk-through-a-grid
🏷️ Tags
#breadth_first_search #graph #array #matrix #shortest_path #heap_priority_queue
Telegraph
find-a-safe-walk-through-a-grid
You are given an m x n binary matrix grid and an integer health. You start on the upper-left corner (0, 0) and would like to get to the lower-right corner (m - 1, n - 1). You can move up, down, left, or right from one cell to another adjacent cell as long…
leetcode.cn 2026-07-03
🔴3620.network-recovery-pathways
🏷️ Tags
#graph #topological_sort #array #binary_search #dynamic_programming #shortest_path #heap_priority_queue
🔴3620.network-recovery-pathways
🏷️ Tags
#graph #topological_sort #array #binary_search #dynamic_programming #shortest_path #heap_priority_queue
Telegraph
network-recovery-pathways
给你一个包含 n 个节点(编号从 0 到 n - 1)的有向无环图。图由长度为 m 的二维数组 edges 表示,其中 edges[i] = [ui, vi, costi] 表示从节点 ui 到节点 vi 的单向通信,恢复成本为 costi。 一些节点可能处于离线状态。给定一个布尔数组 online,其中 online[i] = true 表示节点 i 在线。节点 0 和 n - 1 始终在线。 从 0 到 n - 1 的路径如果满足以下条件,那么它是 有效 的:
leetcode.com 2026-07-03
🔴3620.network-recovery-pathways
🏷️ Tags
#graph #topological_sort #array #binary_search #dynamic_programming #shortest_path #heap_priority_queue
🔴3620.network-recovery-pathways
🏷️ Tags
#graph #topological_sort #array #binary_search #dynamic_programming #shortest_path #heap_priority_queue
Telegraph
network-recovery-pathways
You are given a directed acyclic graph of n nodes numbered from 0 to n − 1. This is represented by a 2D array edges of length m, where edges[i] = [ui, vi, costi] indicates a one‑way communication from node ui to node vi with a recovery cost of costi. Some…
leetcode.cn 2026-07-04
🟡2492.minimum-score-of-a-path-between-two-cities
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
🟡2492.minimum-score-of-a-path-between-two-cities
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
Telegraph
minimum-score-of-a-path-between-two-cities
给你一个正整数 n ,表示总共有 n 个城市,城市从 1 到 n 编号。给你一个二维数组 roads ,其中 roads[i] = [ai, bi, distancei] 表示城市 ai 和 bi 之间有一条 双向 道路,道路距离为 distancei 。城市构成的图不一定是连通的。 两个城市之间一条路径的 分数 定义为这条路径中道路的 最小 距离。 返回城市 1 和城市 n 之间的所有路径的 最小 分数。 注意:
leetcode.com 2026-07-04
🟡2492.minimum-score-of-a-path-between-two-cities
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
🟡2492.minimum-score-of-a-path-between-two-cities
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
Telegraph
minimum-score-of-a-path-between-two-cities
You are given a positive integer n representing n cities numbered from 1 to n. You are also given a 2D array roads where roads[i] = [ai, bi, distancei] indicates that there is a bidirectional road between cities ai and bi with a distance equal to distancei.…
leetcode.cn 2026-07-05
🔴1301.number-of-paths-with-max-score
🏷️ Tags
#array #dynamic_programming #matrix
🔴1301.number-of-paths-with-max-score
🏷️ Tags
#array #dynamic_programming #matrix
Telegraph
number-of-paths-with-max-score
给你一个正方形字符数组 board ,你从数组最右下方的字符 'S' 出发。 你的目标是到达数组最左上角的字符 'E' ,数组剩余的部分为数字字符 1, 2, ..., 9 或者障碍 'X'。在每一步移动中,你可以向上、向左或者左上方移动,可以移动的前提是到达的格子没有障碍。 一条路径的 「得分」 定义为:路径上所有数字的和。 请你返回一个列表,包含两个整数:第一个整数是 「得分」 的最大值,第二个整数是得到最大得分的方案数,请把结果对 10^9 + 7 取余。 如果没有任何路径可以到达终点,请返回 [0…