Your question is Most Frequent Review Across Locations. 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.
Meta Quest collects review strings grouped by bookstore or retail location. Given a dictionary mapping each location to its list of reviews, return the review that appears at the most distinct locations after removing duplicate reviews within each location.
A review contributes at most once per location. If multiple reviews have the same highest frequency, return the lexicographically smallest review. If the input dictionary is empty or contains no reviews, return an empty string.
Implement most_frequent_review(reviews_by_location), where reviews_by_location is a dictionary with string keys and list-of-string values. Return one string according to the rules above.
def most_frequent_review(reviews_by_location):