题目如下: Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after performing t…
原题链接在这里:https://leetcode.com/problems/longest-repeating-character-replacement/description/ 题目: Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the leng…
给你一个仅由大写英文字母组成的字符串,你可以将任意位置上的字符替换成另外的字符,总共可最多替换 k 次.在执行上述操作后,找到包含重复字母的最长子串的长度.注意:字符串长度 和 k 不会超过 104.示例 1:输入:s = "ABAB", k = 2输出:4解释:用两个'A'替换为两个'B',反之亦然.示例 2:输入:s = "AABABBA", k = 1输出:4解释:将中间的一个'A'替换为'B',字符串变为 "AABBBBA".子串 &qu…
以最左边为开始,往右遍历,不一样的个数大于K的时候停止,回到第一个不一样的地方,以它为开始,继续.. 用QUEUE记录每次不一样的INDEX,以便下一个遍历开始, 从左往右,从右往左各来一次..加上各种剪枝情况,比如未遍历的数量<剩余K的数量,比如已经记录过某个INDEX了.. 然后TLE了...最后放TLE的方法..不知道有什么意义.. 上面的做法是左右各来一次,那是否可以使用滑窗呢.. 然后没做出来..看了讨论区..果然是滑窗.. 思路: 统计当前滑窗内最多的字母,窗口宽度 - 最多字母数量…
[LeetCode]522. Longest Uncommon Subsequence II 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/longest-uncommon-subsequence-ii/description/ 题目描述: Given a list of strings, you…
作者: 负雪明烛 id: fuxuemingzhu 公众号:每日算法题 本文关键词:LeetCode,力扣,算法,算法题,字符串,双指针,刷题群 目录 题目描述 题目大意 解题方法 双指针 代码 欢迎加入组织 日期 题目地址:https://leetcode.com/problems/longest-repeating-character-replacement/description/ 题目描述 Given a string that consists of only uppercase En…
Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after performing the abo…
Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after performing the abo…
Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after performing the abo…
1. Question Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after perfor…