Problem · Hash Table
Logger Rate Limiter
Learn this problemProblem statement
For each chronological (timestamp, message) pair, return whether the message should print. The same message may print again only when at least 10 seconds have passed since its most recent successful print. A rejected event does not reset the timer.
Function
shouldPrintSequence(timestamps: int[], messages: String[]) → boolean[]Examples
Example 1
timestamps = [1,2,3,8,10,11]messages = ["foo","bar","foo","bar","foo","foo"]return = [true,true,false,false,false,true]Foo becomes eligible again at time 11, ten seconds after its successful print at time 1.
Constraints
- The arrays have equal non-zero length.
- Timestamps are non-decreasing.
- There are at most
100000events.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024