Compulsively counting objects or actions is a common symptom of OCD. Exposure therapy can help you develop coping mechanisms when you encounter triggers. Obsessive-compulsive disorder (OCD) is a ...
A simple way to do it would be to have a hashmap and iterate through the list once. For every item, add it to the hash with the object as the key and a counter as the value for that key. So if the ...