Hi there
I need some list conversion code snippet. Assume my list contains these values...
2,2,2,5,6,2,1,3,5,7,9,10,10,6,6,4,4,4,4,2,2,2,2
I need a snippet that will return a map maintaining the sequencing of the values and how many times they appear. From above, the output should be
2-3,5-1,6-1,2-1,1-1,3-1,5-1,7-1,9-1,10-2,6-2,4-4,2-4
What the code snippet should do...
1. Pass the list of values in the list (whether sorted / unsorted)
2. The code snippet should detect per value, how many they are e.g 2,2,2 = 2-3, meaning the value 2 appears 3 times
3. The sequence of values should be maintained i.e. there can be another sequence for the same value somewhere in the list, e.g. we start with value 2 and end with value 2.
Thanks a lot!