leetcode.cn 2026-08-08
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
find-the-lexicographically-smallest-valid-sequence
给你两个字符串 word1 和 word2 。 如果一个字符串 x 修改 至多 一个字符会变成 y ,那么我们称它与 y 几乎相等 。 如果一个下标序列 seq 满足以下条件,我们称它是 合法的 :
leetcode.com 2026-08-08
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
find-the-lexicographically-smallest-valid-sequence
You are given two strings word1 and word2. A string x is called almost equal to y if you can change at most one character in x to make it identical to y. A sequence of indices seq is called valid if:
leetcode.cn 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice 和 Bob 继续他们的石子游戏。许多堆石子 排成一行,每堆都有正整数颗石子 piles[i]。游戏以谁手中的石子最多来决出胜负。 Alice 和 Bob 轮流进行,Alice 先开始。最初,M = 1。 在每个玩家的回合中,该玩家可以拿走剩下的 前 X 堆的所有石子,其中 1 <= X <= 2M。然后,令 M = max(M, X)。 游戏一直持续到所有石子都被拿走。 假设 Alice 和 Bob 都发挥出最佳水平,返回 Alice 可以得到的最大数量的石头。 示例 1: 输入:piles…
leetcode.com 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones. Alice and Bob take turns, with…
leetcode.cn 2026-08-10
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
Telegraph
stone-game-iv
Alice 和 Bob 两个人轮流玩一个游戏,Alice 先手。 一开始,有 n 个石子堆在一起。每个人轮流操作,正在操作的玩家可以从石子堆里拿走 任意 非零 平方数 个石子。 如果石子堆里没有石子了,则无法操作的玩家输掉游戏。 给你正整数 n ,且已知两个人都采取最优策略。如果 Alice 会赢得比赛,那么返回 True ,否则返回 False 。 示例 1: 输入:n = 1 输出:true 解释:Alice 拿走 1 个石子并赢得胜利,因为 Bob 无法进行任何操作。 示例 2: 输入:n =…
leetcode.com 2026-08-10
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
Telegraph
stone-game-iv
Alice and Bob take turns playing a game, with Alice starting first. Initially, there are n stones in a pile. On each player's turn, that player makes a move consisting of removing any non-zero square number of stones in the pile. Also, if a player cannot…
leetcode.com 2026-08-24
🔴1872.stone-game-viii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🔴1872.stone-game-viii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-viii
Alice and Bob take turns playing a game, with Alice starting first. There are n stones arranged in a row. On each player's turn, while the number of stones is more than one, they will do the following:
leetcode.cn 2026-09-12
🔴3414.maximum-score-of-non-overlapping-intervals
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
🔴3414.maximum-score-of-non-overlapping-intervals
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
Telegraph
maximum-score-of-non-overlapping-intervals
给你一个二维整数数组 intervals,其中 intervals[i] = [li, ri, weighti]。区间 i 的起点为 li,终点为 ri,权重为 weighti。你最多可以选择 4 个互不重叠 的区间。所选择区间的 得分 定义为这些区间权重的总和。 返回一个至多包含 4 个下标且 字典序最小 的数组,表示从 intervals 中选中的互不重叠且得分最大的区间。
leetcode.com 2026-09-12
🔴3414.maximum-score-of-non-overlapping-intervals
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
🔴3414.maximum-score-of-non-overlapping-intervals
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
Telegraph
maximum-score-of-non-overlapping-intervals
You are given a 2D integer array intervals, where intervals[i] = [li, ri, weighti]. Interval i starts at position li and ends at ri, and has a weight of weighti. You can choose up to 4 non-overlapping intervals. The score of the chosen intervals is defined…
leetcode.cn 2026-09-15
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
maximum-number-of-non-overlapping-palindrome-substrings
给你一个字符串 s 和一个 正 整数 k 。 从字符串 s 中选出一组满足下述条件且 不重叠 的子字符串:
leetcode.com 2026-09-15
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
maximum-number-of-non-overlapping-palindrome-substrings
You are given a string s and a positive integer k. Select a set of non-overlapping substrings from the string s that satisfy the following conditions:
leetcode.cn 2026-09-16
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
Telegraph
number-of-sets-of-k-non-overlapping-line-segments
给你一维空间的 n 个点,其中第 i 个点(编号从 0 到 n-1)位于 x = i 处,请你找到 恰好 k 个不重叠 线段且每个线段至少覆盖两个点的方案数。线段的两个端点必须都是 整数坐标 。这 k 个线段不需要全部覆盖全部 n 个点,且它们的端点 可以 重合。 请你返回 k 个不重叠线段的方案数。由于答案可能很大,请将结果对 109 + 7 取余 后返回。 示例 1: 输入:n = 4, k = 2 输出:5 解释:如图所示,两个线段分别用红色和蓝色标出。 上图展示了 5 种不同的方案 {(0,2)…
leetcode.com 2026-09-16
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
Telegraph
number-of-sets-of-k-non-overlapping-line-segments
Given n points on a 1-D plane, where the ith point (from 0 to n-1) is at x = i, find the number of ways we can draw exactly k non-overlapping line segments such that each segment covers two or more points. The endpoints of each segment must have integral…