No test case is passing
Hi @mudit2jain,
See you can solve this question in a much better way. You can use a variable left which initially points towards 0.Now as you have done in your code make an array say count in which you keep a count of the frequency of both ‘a’ and ‘b’ and simultaneously keep on checking that if min number from count >k
then decrement the value at left-‘a’ index of count and increment left(This is done because we cannot take more than k steps to make the string beautiful) else you just increment ans and in the end print ans.
Hi @mudit2jain
as you are not responding to the doubt I am marking your doubt as resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.
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.