PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Compute top-N active customers

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competence in designing efficient data structures and streaming/top‑K algorithms, handling event-driven updates, correctness under late or expired events, deterministic tie‑breaking, and scalability to millions of customers.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Compute top-N active customers

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: HR Screen

Maintain and return the top N customers by cumulative activity amount, where activity is defined as the sum of deposit amounts, pay amounts, and transfer amounts only when the transfer is successfully accepted (expired transfers contribute nothing). Design data structures and an API (e.g., getTopNActivity(N)) that support near‑real‑time updates as operations occur and efficient queries. Specify update and query complexities, handle late accept events that change a customer’s activity, ensure correctness when transfers expire, define deterministic tie‑breaking (e.g., by customerId then most‑recent activity), and discuss how you would handle changing N between queries and scale to millions of customers.

Quick Answer: This question evaluates a candidate's competence in designing efficient data structures and streaming/top‑K algorithms, handling event-driven updates, correctness under late or expired events, deterministic tie‑breaking, and scalability to millions of customers.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
HR Screen
Coding & Algorithms
4
0

Maintain and return the top N customers by cumulative activity amount, where activity is defined as the sum of deposit amounts, pay amounts, and transfer amounts only when the transfer is successfully accepted (expired transfers contribute nothing). Design data structures and an API (e.g., getTopNActivity(N)) that support near‑real‑time updates as operations occur and efficient queries. Specify update and query complexities, handle late accept events that change a customer’s activity, ensure correctness when transfers expire, define deterministic tie‑breaking (e.g., by customerId then most‑recent activity), and discuss how you would handle changing N between queries and scale to millions of customers.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.