Can you tell me what is the problem in my code for String Compression question?


I am not able to pass 2 test cases

Hey @sahilkhan2312000131 ,
You have used pretty much the correct approach but let us consider the test case where the string is “aabbbbaaabbb” the output to this input is a2b4a3b3 but the output it will produce from your code will be a5b7 which is wrong .
So try and accomodate this edge case as well in your solution . Happy coding !!