Can anyone help me in the swapping part. I can traverse all the string elements but how can I perform swapping of βaβ and βbβ. I really donβt know how to solve this problem.
Sanket and Strings
Hey Saksham! first take for βaβ, so you have to swap only βbβ. Calculate the answer for βaβ. Now do same for βbβ (as you only sway βaβ now!)
eg: string input = ababb and k=2
for βaβ maximum length can be 4(swap 2 b)
for βbβ maximum length can be 5
so answer is 5.
Maybe You can send the code so that I can understand how to implement it and write my own code after that.
Where is the editorial? U are talking about the ide I guess
Not talking about ide!, Editorial/solution is given for every coding task, you can access it.
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.