What you are building
Design the algorithm and interfaces for a service component that receives timestamped string keys and answers how many times a key appeared during the most recent W seconds. Events arrive in timestamp order. Explain the data structures, update and query operations, cleanup strategy, and tests you would use before implementation.