Your question is Max Points With Category Constraints. 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 AI is evaluating a reading list where each book has a category and a recommendation-point value. Given a dictionary of books, choose exactly three books whose categories are all different and return the maximum total points.
Implement max_points_three_categories(books). The input books is a dictionary mapping a unique book ID to a dictionary with two fields: category, a string, and points, an integer. The function must return an integer representing the greatest possible sum of points from three books with pairwise-distinct categories. You may not select the same book more than once.
The input always contains at least three distinct categories, so a valid selection exists. The result depends only on the highest-point book in each category.
def max_points_three_categories(books):