You are given an integer numberOfUsers representing the total number of users, indexed from numberOfUsers
You are also given an array events of length events[i] = [eventType, timestamp, mentionsString].
All users are initially online. When a user goes offline, they remain offline for timestamp
There are two types of events:
Message Event: eventType is "MESSAGE"
The event occurs at timestamp.
mentionsString can take one of the following formats:
"ALL": Mentions every user, whether they are online or offline.
"HERE": Mentions all users who are currently online.
A space separated string of user identifiers formatted as id<number> (for example, "id1 id0"): Mentions the specified users. Each occurrence of an identifier adds
Offline Event: eventType is "OFFLINE"
The user with ID int(mentionsString) goes offline at timestamp and will be back online at timestamp
Return an array mentions of length numberOfUsers, where mentions[i] represents the total number of mentions user
Note: Events might not be sorted by timestamp. If multiple events occur at the same timestamp, all
"OFFLINE"events must be processed before any"MESSAGE"events.
Constraints:
numberOfUsers
events.length
events[i].length
events[i][0] will be one of "MESSAGE" or "OFFLINE"
int(events[i][1])
The number of id<number> mentions in any "MESSAGE" event is between
<number> numberOfUsers
It is guaranteed that the user id referenced in the OFFLINE event is online at the time the event occurs.
You are given an integer numberOfUsers representing the total number of users, indexed from numberOfUsers
You are also given an array events of length events[i] = [eventType, timestamp, mentionsString].
All users are initially online. When a user goes offline, they remain offline for timestamp
There are two types of events:
Message Event: eventType is "MESSAGE"
The event occurs at timestamp.
mentionsString can take one of the following formats:
"ALL": Mentions every user, whether they are online or offline.
"HERE": Mentions all users who are currently online.
A space separated string of user identifiers formatted as id<number> (for example, "id1 id0"): Mentions the specified users. Each occurrence of an identifier adds
Offline Event: eventType is "OFFLINE"
The user with ID int(mentionsString) goes offline at timestamp and will be back online at timestamp
Return an array mentions of length numberOfUsers, where mentions[i] represents the total number of mentions user
Note: Events might not be sorted by timestamp. If multiple events occur at the same timestamp, all
"OFFLINE"events must be processed before any"MESSAGE"events.
Constraints:
numberOfUsers
events.length
events[i].length
events[i][0] will be one of "MESSAGE" or "OFFLINE"
int(events[i][1])
The number of id<number> mentions in any "MESSAGE" event is between
<number> numberOfUsers
It is guaranteed that the user id referenced in the OFFLINE event is online at the time the event occurs.