NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

(This question is a variation of the LeetCode question 692. Top K Frequent Words. If you haven't completed that question yet, it is recommended to solve it first.)

You are given an array of messages where each element is a triplet: [<sender>, <receiver>, <message>]. For each sender-receiver pair, if the sender sends multiple messages to the same receiver, they are considered duplicates (spam).

Test Cases
Input
Output
Expected