https://ide.codingblocks.com/s/56539
what is the problem in this code
i know this is not an efficient solution but still
Sanket_and_strings
what is a thought process behind this solution
Hey Mudit, its pretty simple as you will be having only 2 two chars in the string a and b, so in this code you are just maintaining the minimum changes you are making for getting the longest required string till the particular index.
Hey, my code is passing just the first test case.
Kindly help me out where i am wrong.
link to my code :-
Hey Tanay, in your code your if - elseif conditions will not give the correct length of the substring.
check for this case
input:
7
aaabababbababbbbbbbaaaaaabbbbababbababbbaaa
your code’s output:
30
but the expected output:
19