how to approach this…
how can we maximize substring.
my approch -
- count a & b
- will pick min one and swap with max one
what if both equal
i think this will not work…
please provide some better approach
how to approach this…
how can we maximize substring.
my approch -
what if both equal
i think this will not work…
please provide some better approach
hello @S18LPC-OL0078 you have to this with some optimised approach as constraints are large .
one of the possible way is :
lets suppose you are checking and you find that character you are at now is not same and then you will put one counter variable and if that counter variable is greater than k then you will start decrement from start that counter variable from until that counter is less than k and in that way you will maximise your result .
here for your reference i am attaching a code .https://ide.codingblocks.com/s/323463
i hope i have clear your doubt .
Happy learning !!
hey @S18LPC-OL0078 as you are not responding to the doubt which you have raised a month before ,i hope your doubt is cleared now and you can now mark this doubt as cleared now and do hit the like button .
Happy Learning !!
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.