SanketAndStrings

Your logic is wrong. You’re trying to convert all the first k a’s or b’s at the starting only. It is possible that it wont give the correct result as it may be required to toggle at the end and not at the start for the best answer.
Also, in your logic you are resetting count so there is no purpose of the first conversion loop

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.