Logger Rate Limiter
Difficulty: Easy
Category: DSA
Topics: Hash Table, Design, Data Stream
Asked at: Google, Apple, Amazon, Bloomberg, Microsoft, Oracle
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^9`
- `1 <= message.length <= 30`
- At most `10^4` calls will be made to `shouldPrintMessage`.
Return _true_ if the message should be printed at the given timestamp, otherwise return _false_.