Company: Amazon Sde1_1may

Difficulty: medium

Problem Statement

MovieDB Watchlist Description MovieDB lets users explore movies, rate them, and save the ones they want to watch later. You are rebuilding the backend of the watchlist feature. Each user has a watchlist: an ordered collection of distinct movie ids. A user may add a movie to it, remove a movie from it, or read it back. To stop spam and automated activity the backend applies a sliding-window rate limit : a user may perform at most 10 accepted add/remove operations inside any 120-second window . Concretely, an add or remove issued by user u at time t is accepted if and only if the number of operations by u that were already accepted at a time strictly greater than t - 120 is less than 10. An accepted operation is recorded and consumes one unit of that user's budget; a rejected operation is not recorded and consumes nothing , so it does not push the next operation further out. Reading a watchlist is free and never touches the limiter. The watchlist itself behaves like a set that remembers

More Amazon Sde1_1may OA questionsInterview experiences