There is some magic in life. Found a way to count number of occurances of all elements in array (only if they are sorted). Basic idea was:
- Read the values in the array
- Sort the array
- Enumerate the array, and ignore (but count) any elements matching the previous element. reset the counter when you discover a new element.
Let array => array
Original link: https://stackoverflow.com/questions/28256415/find-occurrences-in-array