← 返回 amazon 的题目列表Longest substring with at most K flips
类型:online_judge
Given a string and an integer k, you can flip any character in the string to another character. Find the length of the longest substring containing only one type of character after at most k flips. For example, in the string "abaabaa" and k=1, you can flip the second 'b' to 'a', changing the string to "abaaaaa", with the longest substring containing only one type of character being "aaaaa", which has a length of 5.
Example
Input
"abaabaa", 1