[Java/Python 3] Two codes w/ analysis.
Method 1: Sort the senders with the largest word count\njava\n    public String largestWordCount(String[] messages, String[] senders) {\n        Map<String, Int
**Method 1: Sort the senders with the largest word count**\n```java\n    public String largestWordCount(String[] messages, String[] senders) {\n        Map<String, Integer> cnt = new HashMap<>();\n        int largest = 0;\n        for (int i = 0; i < senders.length; ++i) {\n            largest = Math.max(largest, cnt.merge(senders[i], messages[i].split(" ").length, Integer::sum));\n        }\n        TreeSet<String> senderSet = new TreeSet<>();\n        for (var entry : cnt.entrySet()) {\n            if (entry.getValue() == largest) {\n                senderSet.add(entry.getKey());\n            }\n        }\n        return senderSet.pollLast();\n    }\n```\n```python\n    def largestWordCount(self, messages: List[str], senders: List[str]) -> str:\n        c = Counter()\n        mx = 0\n        for s, m in zip(senders, messages):\n            c[s] += len(m.split())\n            mx = max(mx, c[s])\n        for s in reversed(sorted(c)):\n            if c[s] == mx:\n                return s\n```\n**Analysis:**\nTime: `O(nlogn)`, space: `O(n)`, where `n = senders.length`.\n\n----\n\n**Method 2: No sort** - inspired by **@giulian**\n\n```java\n    public String largestWordCount(String[] messages, String[] senders) {\n        Map<String, Integer> cnt = new HashMap<>();\n        int largest = 0;\n        for (int i = 0; i < senders.length; ++i) {\n            largest = Math.max(largest, cnt.merge(senders[i], messages[i].split(" ").length, Integer::sum));\n        }\n        String sender = "";\n        for (var entry : cnt.entrySet()) {\n            if (entry.getValue() == largest && sender.compareTo(entry.getKey()) < 0) {\n                sender = entry.getKey();\n            }\n        }\n        return sender;\n    }\n```\n```python\n    def largestWordCount(self, messages: List[str], senders: List[str]) -> str:\n        c = Counter()\n        mx = 0\n        for s, m in zip(senders, messages):\n            c[s] += len(m.split())\n            mx = max(mx, c[s])\n        sender = \'\'    \n        for k, v in c.items():\n            if v == mx and sender < k:\n                sender = k\n        return sender\n```\n**Analysis:**\nTime & space: `O(n)`, where `n = senders.length`.
[]