← 返回 netflix 的题目列表Print Unique Events Within Time Window
类型:online_judge
Given a time window, e.g., 1 minute, write a print_event function to process an input event with fields name and timestamp. You should print each event only once within the given time window. Ignore subsequent identical events within the same time window. Ensure the function can handle out-of-order timestamp inputs. Investigate how to remove expired events, discussing options like LRU cache, lazy deletion, or periodic cleanup.
Example
Input
{"name": "event1", "timestamp": 100}