Java | Easy | Simple
Code
# Code
```
class Solution {
    public void helper1(int []arr){
        for(int i=0;i<arr.length;i++)arr[i]++;
    }
    public void helper2(int []arr,int []mentions,int curr){
        for(int i=0;i<arr.length;i++){
            if(arr[i]==-1)mentions[i]++;
            else if(curr<arr[i] || curr>=arr[i]+60)mentions[i]++;
        }
    }
    public void helper3(int []arr,int []mentions,String ids,int curr){
        String []users=ids.split(" ");
        for(int i=0;i<users.length;i++){
            int num=(Integer.parseInt(users[i].substring(2,users[i].length())));
            mentions[num]++;
        }
    }
    public int[] countMentions(int users, List<List<String>> events) {
        events.sort((e1, e2) -> {
            int timestamp1 = Integer.parseInt(e1.get(1));
            int timestamp2 = Integer.parseInt(e2.get(1));
            
            if (timestamp1 != timestamp2) {
                return Integer.compare(timestamp1, timestamp2);
            }
            if (e1.get(0).equals("OFFLINE") && e2.get(0).equals("MESSAGE")) {
                return -1;
            } else if (e1.get(0).equals("MESSAGE") && e2.get(0).equals("OFFLINE")) {
                return 1;
            }
            return 0;
        });
        int []arr=new int[users];
        Arrays.fill(arr,-1);
        int[]mentions=new int[users];
        int ne=events.size();
        for(int i=0;i<events.size();i++){
            List<String>curr=events.get(i);
            if(curr.get(0).equals("OFFLINE")){
                int ind=Integer.parseInt(curr.get(2));
                int tsp=Integer.parseInt(curr.get(1));
                arr[ind]=tsp;
            }else{
                if(curr.get(2).equals("HERE")){
                    helper2(arr,mentions,Integer.parseInt(curr.get(1)));
                }else if(curr.get(2).equals("ALL")){
                    helper1(mentions);
                }else{
                    helper3(arr,mentions,curr.get(2),Integer.parseInt(curr.get(1)));
                }
            }
        }
        return mentions;
    }
}
```
['Java']