Longest repeating character replacement

how Do I approach the following question:
https://online.codingblocks.com/app/player/189053/content/180231/5369/code-challenge

hi @s.kumar
i am unable to open the ques link… pls maybe send the screenshot of the ques…

Hi @s.kumar
so there can be 2 cases… in one case u try to flip a and find length… in second case u try to flip b and find length… then take max of both the lengths… refer this https://ide.codingblocks.com/s/617560

Hi @s.kumar I hope ur doubt is cleared now??

I didn’t get your approach

I didn’t get your approach,

can you explain from line 14 to 23 plz

the logic is same like this https://www.geeksforgeeks.org/find-zeroes-to-be-flipped-so-that-number-of-consecutive-1s-is-maximized/
what i am trying to do is in flipa function i am trying to flip a single a to b and trying to find length of max consecutive b’s. vice versa is the case of other function…

i hope it is clear now??

are bhai fir code ka explanation diya to hai ki kya kiya hai exactly… baki to tumhe dry run krke dekhna pdega na… gfg link isliye bheja tha vo ques similar tha…

if still there is any confusion in the ques do let me… or else shall i mark it as 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.