Object-Oriented Programming · Google · Easy
Design a class that keeps track of messages exchanged between users. A single message is described by a pair (A, B). Messaging is symmetric, so (A, B) and (B, A) describe the same interaction. The class must provide two operations: Every call to register(a, b) adds 1 to the interaction count of a and also adds 1 to the interaction count of b. When several users share the highest count, mostActiveUser() may return any one of them. Assumptions: A user ID may be a string or an…