I am not able to pass all test cases. Please help me
String Compression
Hey @meet1708 please share your code using ide.codingblocks.com, if you don’t know how to do that let me know i will help.
Okay so i got your approach, sorry to tell you but mapping of character array won’t work in this question as it’s a 2 pointer problem so when you give an input of:
aaaqqwwccaaawwwcc
Your expected answer should be: a3q2w2c2a3w3c2
But if you will do it using mapping it will give you:
a6w4a2w5
Use 2 pointer approach to solve this problem.
One pointer to traverse on string and other to compress the string.
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.