You are designing a logger system that receives a stream of messages, each accompanied by a timestamp in seconds. Implement the Logger class:
Logger() initializes the logger object.bool shouldPrintMessage(int timestamp, string message) returns true if the message should be printed at the given timestamp, otherwise returns false.A message should only be printed if it has not been printed in the last 10 seconds (including the current timestamp). Each call to shouldPrintMessage will have a non-decreasing timestamp.
Constraints:
0 <= timestamp <= 10^91 <= message.length <= 3010^4 calls will be made to shouldPrintMessage.Return true if the message should be printed at the given timestamp, otherwise return false.
Need help or want more practice?