Can you give me a hint about how to solve this problem.
Here is my code
SanketAndString
I don’t get your logic , what are you trying to do? Please explain your approach.
please tell me how to solve this problem
The logic for solving this problem is a simple one, we begin with 2 pointers left and right, we freeze left and increase right till it is possible to make string from left to right of one character once number of different character exceeds k, we move left pointer till it becomes less than k and then we freeze left pointer and move right and this process continues till right reaches n. We do this because this way we can find the maximum solution for each left.
If you are not able to implement this then please tell, I would share the code with you.
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.