Hi I just dont want to use map here, however the solution i am using is passing the two test cases but failing the oter two can someone please assist what is wrong with my code here: https://ide.codingblocks.com/s/154589
Thanks
Hi I just dont want to use map here, however the solution i am using is passing the two test cases but failing the oter two can someone please assist what is wrong with my code here: https://ide.codingblocks.com/s/154589
Thanks
Rohit, basically your code wont work for test cases, where the characters would be repeated twice,
For eg,
aaabbccdsaaa
Your output : a6b2c2d1s1
Actual output : a3b2c2d1s1a3
I would recommend you to use some variable count, instead of hashmap since it would fail in the above scenario explained.