InterviewDB Question

Top Events - Rank and Return Most Popular Events by Attendance

Question Details

Problem You have a stream of event attendance records {event_id, user_id, timestamp}. Implement a class that supports: record(event_id, user_id, timestamp) - log an attendance entry. top_k(k, start_ts, end_ts) -> List[str] - return the top k event IDs by unique attendee count within the time range, sorted by count descending; break ties by event_id ascending. Example: Follow-ups How do you count unique attendees per event efficiently without a full scan? If records can be ingested out of order,…

Full Details

🔒

Unlock all Two Sigma questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a reported interview question from a two sigma interview during the phone round.

It covers the following topics: Coding, Onsite, Phone .