Design a logger that prints a message only if it has not been printed in the last 10 seconds. Pattern focus: Queue Simulation. A queue of active messages or timestamps helps enforce the time-based rule efficiently.
messages = array of message strings, timestamps = corresponding times
booleans indicating whether each message should be printed
Example 1:
Input:
messages = ["foo","bar","foo","bar","foo"] timestamps = [1,2,3,8,11]
Output:
[true,true,false,false,false]
Explanation:
Repeated messages within 10 seconds are suppressed.
Example 2:
Input:
messages = ["a","a","a"] timestamps = [1,11,21]
Output:
[true,true,true]
Explanation:
Each repeat occurs after 10 seconds, so all are printed.