Algorithm · Reddit · Easy
Design a logger system that receives a stream of messages along with their timestamps. The system must enforce a 10-second cooldown rule: if an identical message has already been printed within the last 10 seconds, the current message should be suppressed. Otherwise, the message is allowed to print, and its timestamp is recorded as the most recent time it was printed. Implement the Logger class: Logger() initializes the logger object. shouldPrintMessage(timestamp: int,…
Checking your access…