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-13
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
Telegraph
longest-substring-of-one-repeating-character
给你一个下标从 0 开始的字符串 s 。另给你一个下标从 0 开始、长度为 k 的字符串 queryCharacters ,一个下标从 0 开始、长度也是 k 的整数 下标 数组 queryIndices ,这两个都用来描述 k 个查询。 第 i 个查询会将 s 中位于下标 queryIndices[i] 的字符更新为 queryCharacters[i] 。 返回一个长度为 k 的数组 lengths ,其中 lengths[i] 是在执行第 i 个查询 之后 s 中仅由 单个字符重复 组成的 最长子字符串…
leetcode.com 2026-08-13
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
Telegraph
longest-substring-of-one-repeating-character
You are given a 0-indexed string s. You are also given a 0-indexed string queryCharacters of length k and a 0-indexed array of integer indices queryIndices of length k, both of which are used to describe k queries. The ith query updates the character in s…
leetcode.cn 2026-08-14
🟢3090.maximum-length-substring-with-two-occurrences
🏷️ Tags
#hash_table #string #sliding_window
🟢3090.maximum-length-substring-with-two-occurrences
🏷️ Tags
#hash_table #string #sliding_window
Telegraph
maximum-length-substring-with-two-occurrences
给你一个字符串 s ,请找出满足每个字符最多出现两次的最长子字符串,并返回该子字符串的 最大 长度。 示例 1: 输入: s = "bcbbbcba" 输出: 4 解释: 以下子字符串长度为 4,并且每个字符最多出现两次:"bcbbbcba"。 示例 2: 输入: s = "aaaa" 输出: 2 解释: 以下子字符串长度为 2,并且每个字符最多出现两次:"aaaa"。 提示:
leetcode.com 2026-08-14
🟢3090.maximum-length-substring-with-two-occurrences
🏷️ Tags
#hash_table #string #sliding_window
🟢3090.maximum-length-substring-with-two-occurrences
🏷️ Tags
#hash_table #string #sliding_window
Telegraph
maximum-length-substring-with-two-occurrences
Example 1: Input: s = "bcbbbcba" Output: 4 Explanation:
leetcode.cn 2026-08-26
🟡2904.shortest-and-lexicographically-smallest-beautiful-string
🏷️ Tags
#string #sliding_window
🟡2904.shortest-and-lexicographically-smallest-beautiful-string
🏷️ Tags
#string #sliding_window
Telegraph
shortest-and-lexicographically-smallest-beautiful-string
给你一个二进制字符串 s 和一个正整数 k 。 如果 s 的某个子字符串中 1 的个数恰好等于 k ,则称这个子字符串是一个 美丽子字符串 。 令 len 等于 最短 美丽子字符串的长度。 返回长度等于 len 且字典序 最小 的美丽子字符串。如果 s 中不含美丽子字符串,则返回一个 空 字符串。 对于相同长度的两个字符串 a 和 b ,如果在 a 和 b 出现不同的第一个位置上,a 中该位置上的字符严格大于 b 中的对应字符,则认为字符串 a 字典序 大于 字符串 b 。
leetcode.com 2026-08-26
🟡2904.shortest-and-lexicographically-smallest-beautiful-string
🏷️ Tags
#string #sliding_window
🟡2904.shortest-and-lexicographically-smallest-beautiful-string
🏷️ Tags
#string #sliding_window
Telegraph
shortest-and-lexicographically-smallest-beautiful-string
You are given a binary string s and a positive integer k. A substring of s is beautiful if the number of 1's in it is exactly k. Let len be the length of the shortest beautiful substring. Return the lexicographically smallest beautiful substring of string…
leetcode.cn 2026-08-27
🟡3720.lexicographically-smallest-permutation-greater-than-target
🏷️ Tags
#greedy #hash_table #string #counting #enumeration
🟡3720.lexicographically-smallest-permutation-greater-than-target
🏷️ Tags
#greedy #hash_table #string #counting #enumeration
Telegraph
lexicographically-smallest-permutation-greater-than-target
给你两个长度均为 n 且仅由小写英文字母组成的字符串 s 和 target。
leetcode.com 2026-08-27
🟡3720.lexicographically-smallest-permutation-greater-than-target
🏷️ Tags
#greedy #hash_table #string #counting #enumeration
🟡3720.lexicographically-smallest-permutation-greater-than-target
🏷️ Tags
#greedy #hash_table #string #counting #enumeration
Telegraph
lexicographically-smallest-permutation-greater-than-target
You are given two strings s and target, both having length n, consisting of lowercase English letters. Return the lexicographically smallest permutation of s that is strictly greater than target. If no permutation of s is lexicographically strictly greater…