← Questions
Most active user by distinct contacts, then top K
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Users send each other messages, and a message between A and B counts as contact for both of them. Build a class with:
-
register(a, b): record a message betweenaandb. -
most_active_user(): return the user with the most distinct contacts, in O(1).
Follow-up: return the top k users, where k can change from one call to the next. Other reports framed it as tracking the most active users in a live stream of communication.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
