Design a logger that receives a stream of messages with timestamps and decides whether each message should be printed. A message may be printed only if it has NOT been printed in the last 10 seconds.
shouldPrint(timestamp, message)returnstrueif the message can be printed at the given timestamp (it was never printed before, or its last printed time is<= timestamp - 10). When it returnstrue, it records this timestamp as the message's last printed time. If it returnsfalse, nothing is recorded.
Timestamps arrive in non-decreasing order.
Implement the function logger(operations) where operations is a list of [op, ...args]: ["shouldPrint", timestamp, message]. Return the list of results, one per operation (use null for operations that return nothing - though every operation here returns a boolean).