How can i optimize this code
TLE in two test cases
@hemantomer1
optimized approach
- Take the first character of the present string and store it in say βchβ. Start iterating over the string and obtain the count of this character occurring consecutively from this point.
- Obtain the answer for remaining string recursively.
- Return ch+countOfCh+recursiveResult .
editorial code for ref
https://ide.codingblocks.com/s/279900
dont forget to hit like and mark resolved if cleared
1 Like
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.