原题链接
The only difference between easy and hard versions is the size of the input.
You are given a string s consisting of nn characters, each character is 'R', 'G' or 'B'.
You are also given an integer k. Your task is to change the minimum number of characters in the initial string s so that after the changes there will be a string of length k that is a substring of s, and is also a substring of the infinite string "RGBRGBRGB ...".
A string a is a substring of string b if there exists a positive integer ii such that ,
,
, ...,

给定一个字符串s和整数k,求使s中存在长度为k且为'RGBRGB...'子串的最少修改次数。对于多个查询,输出每个查询的最小修改次数。
最低0.47元/天 解锁文章
191

被折叠的 条评论
为什么被折叠?



