Logger Rate Limiter
Updated
Problem 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 Online Assessment questions
- 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
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Design Hash MapGoldman Sachs · OA · PHONE SCREENGoldman Sachs interview questions
- Student and Course EnrollmentWells Fargo · OAWells Fargo interview questions
- Design an Ordered StreamBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- For All Intents And Purposes Part 1 - Initializing the System 🏗️Stripe · OAStripe interview questions
- Worker Management (Promotion Track), Part 4: Full-Shift Double PayAirbnb · OAAirbnb interview questions
- Overheat Prevention ControllerOptiver · OAOptiver interview questions
- LRU CacheTypeSafe AI · OA
- Authentication SystemMicrosoft · OAMicrosoft interview questions
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Out-of-Order Bank Ledger BalancesPerplexity AI · OAPerplexity AI interview questions