sir two of my test cases are failing …cannot able to understand why…i m maintaining the insertion order also
link: https://ideone.com/VKOxUn
String Compression Doubts
Hi Arghya, which course are you enrolled in? Because your code is in java and you’ve posted it in Algo++ course.
yes Mam i am from Algo++ , but i have done this problem in java is this a problem ! because i found in can use LinekdHashMap to maintain the order
Alright, consider the following case when the input is:
aabbaacd
The expected output is:
a2b2a2cd
But your code’s output is:
a4b2c1d1
Since you’re using a hashmap, it is adding all the occurrences of a single character and printing it together, whereas you’re supposed to count the number of consecutive times a character appears.
Ok mam got it I didn’t try this test case