Kindly help me with the recursive approach for the question
Help in Approach
hello @rishabhkumardeveloper
the recurive approach of this problem can be.
solve(i,k) = max(u can change current character solve(i+1,k-1) , u keep current character as it is solve(i+1,k) )
i -> index
k-> number of allowed swaps
base case -> find lenght length of longest consective same character and return then same
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.