Your question is Find Top K Most Frequently Read Books. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a massive log file represented as a list of strings, where each string is the title of a book that a user has read, implement a function to find the top K most frequently read books.
The function should return a list of the top K book titles sorted by their frequency in descending order. If two books have the same frequency, return them in alphabetical order.
def top_k_frequent_books(logs, K):