Skip to content
Discussion options

You must be logged in to vote

We need to track user mentions from MESSAGE events, considering that users can go offline and come back online after 60 time units. We must handle three types of mentions:

  • id<number>: Mention specific users (can be multiple, duplicate)
  • ALL: Mention all users (online and offline)
  • HERE: Mention only online users

Approach:

  1. Sort events by timestamp to process in chronological order
  2. Track when users come back online using a priority queue or by checking if current time >= offline_time + 60
  3. For each timestamp, first process any users coming back online, then process offline events, then message events
  4. Count all mentions (including duplicates in the same message)

Let's implement this solutio…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Dec 12, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants