Leetcode 1912. Design Movie Rental System
Maintain dynamic collections to (1) return the cheapest up-to-5 shops that have an unrented copy of a given movie and (2) report the cheapest up-to-5 currently rented movies, while supporting rent/drop operations that move items between those collections. The challenge is to handle frequent updates and top-k queries efficiently using ordered data structures keyed by price and the specified tie-breakers (shop, movie).
Asked at:

Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid September, 2024

Amazon
Mid-level
Implement a movie rental system with the following operations: 1) search(movie_id): Returns the 5 cheapest channel IDs for the specified unrented movie. 2) rent(movie_id, channel_id): Marks the movie as rented from the specified channel, so it will no longer appear in future search results for that movie. The system should handle a vector of vectors containing movie ID, channel ID, and price information.
Your account is free and you can post anonymously if you choose.