Implement most_frequent_key without using max() | Apple