Back to problems

Top K Book Sales

Object-Oriented Programming · Snowflake · Easy

Implement a real‑time sales tracking system that accumulates total sales for each book and can instantly return the top‑selling books. The BookSalesTracker class must support these operations: BookSalesTracker() – initializes an empty tracker with no sales records. bestSellers(List books, List counts, int k) – adds the given counts to the cumulative sales of the corresponding books in books, then returns the k books with the highest overall sales. The ordering of the…

Checking your access…