What is the meaning of maximum length substring of equal characters. ?
What is the meaning of maximum length substring of equal characters.?
It means that the longest continuous part of a string that has equal number of a’s and b’s
Like aabbaa
Here abba and aabb (both) are the longest continuous parts which have equal number of a’s and b’s
bbaa is another longest continuous part that has equal number of a’s and b’s
What is the use of k then ??
k is a number. We can change a maximum of k characters (from a to b OR from b to A) in our string.
After changing some or zero characters (at max k) we have to find the longest continuous sub string which have equal number of a’s and b’s.
Example
k = 3 and string is aabbaabbaa
if I don’t change anything length of longest continuous substring is 8 = bbaabbaa
If I change ‘a’ at index 0 to ‘b’ then maximum length changes to 10 = babbaabbaa
So in this question you need to change some characters (possibly zero and max k) and find the length of the longest continuous substring that is formed.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.