FastPrepDelayed Streaming Duplicate Suppression
Problem · Hash Table

Delayed Streaming Duplicate Suppression

MediumGoogle logoGoogleFULLTIMEPHONE SCREEN
See Google hiring insights

Problem statement

A logging service receives a stream of statuses in nondecreasing timestamp order. Each status contains an integer timestamp in seconds and a case-sensitive message.

A status is isolated when no other status with the exact same message has an absolute timestamp difference strictly less than 10 seconds. If two equal messages occur within that window, both occurrences are suppressed. This rule can suppress every status in a chain of nearby equal messages.

The problem statement continues
Pro

Examples

Example 1

timestamps = [1,5,12,23]messages = ["foo","foo","foo","foo"]return = ["[23s] foo"]

The occurrences at 1 and 5 are within 4 seconds, while those at 5 and 12 are within 7 seconds, so the first three statuses are suppressed. The occurrence at 23 is 11 seconds after the preceding one and is shown.

Original screenshot from the interview report
Pro
FastPrep Pro
Reported in 2 Google interviews this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week
CodePython 3
Run and Submit unlock with Pro
FastPrep Pro
Reported in 2 Google interviews this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week