← All questions
Coding
Top K Active Users
Asked at
HubSpot
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Define activity and the time window.
- 02Aggregate one count per user.
- 03Use a size-k min-heap or sort counts.
- 04Apply the required tie-breaker before returning results.
Reference answer
Then expect these follow-ups
How would you maintain this over a sliding day window?
Tests: streaming
What tie-breaker makes the result deterministic?
Tests: product semantics
Hiring now
HubSpot has 140 open roles right now
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Lead Customer Success Manager, Strategic Accounts
Remote - Ireland
Senior Accounts Payable Coordinator
Bogotá, Colombia
Lead Solutions Engineer
Remote
Next question