FastPrepLogger Rate Limiter with Every-Arrival History
Problems/Logger Rate Limiter with Every-Arrival History

Logger Rate Limiter with Every-Arrival History

Google logoGoogle● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The author clearly separates this follow-up from the standard logger that only records accepted messages. They use arrivals at 0, 5, and 12, and say every arrival updates the dictionary. Here we use ordered timestamps and the exact ten-second boundary. Our version is about 97% the same as the reported question.

Messages arrive at integer timestamps that never go backward. For each pair [timestamp,message], print the message exactly when it has not arrived during the previous 10 seconds: if its prior arrival time is last, require timestamp-last >= 10.

Whether printed or skipped, every arrival becomes the new last time for that message. Different messages are tracked independently.

Return one boolean per arrival, true when printed.

Function

shouldPrintMessages(timestamps: int[], messages: String[]) → boolean[]

Examples

Example 1

timestamps = [0,5,12]messages = ["x","x","x"]return = [true,false,false]

The arrival at 5 is suppressed but resets history, so 12 is only seven seconds later and is also suppressed.

Example 2

timestamps = [1,2,11,12]messages = ["a","b","a","b"]return = [true,true,true,true]

Each message's arrivals are exactly ten seconds apart.

Example 3

timestamps = []messages = []return = []

No arrivals produce no decisions.

Constraints

  • 0 <= timestamps.length = messages.length <= 200000.
  • Timestamps are nondecreasing integers in [0,10^9].
  • Messages are nonempty case-sensitive strings.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Propagating Fraud DetectorAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
  • Order and Batch Open-Close LifecycleHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions
  • Resource Reconciler: Plan and Apply CreatesPerplexity AI · PHONE SCREENPerplexity AI interview questions
  • Realized Gains from a Real-Estate Transaction StreamKikoff · PHONE SCREENKikoff interview questions
  • Process On-Call Routing OperationsOpenAI · PHONE SCREENOpenAI interview questions
  • Batched Key Fetch CallbacksAnrok · PHONE SCREEN
  • Earliest Car for Each PassengerWhatNot · PHONE SCREENWhatNot interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public boolean[] shouldPrintMessages(int[] timestamps, String[] messages) {
        // Write your code here.
    }
}
Checking account…