
Jake D. answered 03/07/22
Professional Software Engineer and Foundations of CS Teacher
I would say the best solution here would be tp use a dictionary. Loop over each item in the list of numbers. For each number, check to see if it already exists in the dictionary as a key, if it does, increment its value by 1. Otherwise add a new key and set its value to 1.