Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Deduplicate Meta Event Stream

Easy
EasyCodingAsked 1 times

Problem

In a Meta event pipeline, duplicate records may arrive for the same event ID. Write a function that removes duplicates by event_id, keeping only the event with the largest timestamp for each ID.

Return the deduplicated events sorted by timestamp ascending. If two events have the same event_id and the same timestamp, keep the one that appears later in the input.

Constraints

  • 0 <= len(events) <= 10^5
  • event_id is a non-empty string
  • 0 <= timestamp <= 10^9
  • Each event contains keys: event_id, timestamp, payload

Function Signature

def deduplicate_events(events):
Practicing as: Data Engineer interview at Meta

Hi, I'll play your Meta interviewer for the Data Engineer role. Candidates describe these interviews as mostly positive and moderately difficult, so expect me to be friendly and conversational. Take your time with the question above and answer like we're in the room.

Take this as a live interview session →

You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.

Sign up freeI have an account
def solve(rows):
    counts = {}
    for row in rows:
        ...
    return result
Sign up to unlock solutions
Meta Data Engineer Interview Questions
Next questions
MetaDeduplicate Ordered Event StreamMediumMastercardDeduplicate JSON Task EventsEasyKlaviyoDeduplicate Events Preserving First OrderEasy