plz check my code, plz help me solving this problem ,it has been not solved satisfactory anytime,
SanketAndStrings
Hello @akb.tech17
In this question you are given an integer k and a string of ‘a’ and ‘b’. What you need to do is that you have to replace either ‘a’ by ‘b’ or ‘b’ by ‘a’ at most k time so that you get a string of maximum length of either continuous ‘a’ or continuous ‘b’.
For example
k = 2
string = “aabababaabb”
If we replace b at index 2 and index 4, we get string of a of length 6 and 6 is the perfectness of the above string.
Here is the code
Dry run the above code on below test case to see how the code works
1
abbbaaabbbbb
If you still need any help, leave a reply and I will help you out.