Simple Python Solution | 🔥 100% beat | Queue
IntuitionAfter sorting the events based upon the time.ApproachUsing Queue to keep track of the offline users.Complexity

Time complexity: O(u * n + n * log(n))
# Intuition
After sorting the events based upon the time. 
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
Using Queue to keep track of the offline users.

# Complexity
- Time complexity: O(u * n + n * log(n)) where u is number of users

- Space complexity: O(u)
# Code
```python3 []
class Solution:
    def countMentions(self, numberOfUsers: int, events: List[List[str]]) -> List[int]:
        # queue of offline users
        offline = deque()
        # keep track of users who are offline and online
        onlines = [True for i in range(numberOfUsers)]
        mentions = [0 for i in range(numberOfUsers)]
        # sort the events based upon the time, and also if offline time should come first if we have similar time 
        events.sort(key=lambda x : [int(x[1]), 0] if x[0] == "OFFLINE" else [int(x[1]), 1])
        
        for command, time, users in events:
            time = int(time)
            # any user that have been offline for more than or equal to 60 must come back online
            while offline and (offline[0][1] + 60) <= time:
                    user = offline.popleft()[0]
                    onlines[user] = True
            if command == "OFFLINE":
                # mark user as offline
                user = int(users)
                onlines[user] = False
                offline.append((user, time))
            else:
                current_time = time
                
                if users == "ALL":
                    for i in range(numberOfUsers):
                        mentions[i] += 1
                elif users == "HERE":
                    for i in range(numberOfUsers):
                        if onlines[i]: # to make sure if the user is online
                            mentions[i] += 1
                else:
                    for ids in users.split():
                        user = int(ids[2:])
                        mentions[user] += 1
                
        return mentions 
```
['Queue', 'Sorting', 'Python3']