PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Uber

Design structure for bottom-K customers by revenue

Last updated: Mar 29, 2026

Quick Overview

This question evaluates data structure design and algorithmic complexity for dynamic order-statistics and update operations, focusing on maintaining current revenue and returning the bottom-K (K smallest) elements, and falls under the Coding & Algorithms domain.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Design structure for bottom-K customers by revenue

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are building an in-memory data structure to track customers’ **current revenue** and answer “top K” queries, where **top K means the K smallest revenues**. Implement a class/data structure that supports: 1. `upsert(customerId, revenue)`: Insert a new customer with the given `revenue`, or update an existing customer to this new `revenue`. 2. `bottomK(k) -> List[customerId]`: Return the IDs of the **k customers with the smallest current revenue**. Requirements / clarifications: - `customerId` is unique. - Revenues can repeat across customers. - If `k` is larger than the number of customers, return all customers. - If multiple customers have the same revenue, return them in increasing `customerId` order (or state and apply any deterministic tie-break). - Aim for efficient time complexity; be ready to discuss trade-offs for **read-heavy** workloads (many `bottomK`) vs **write-heavy** workloads (many `upsert`).

Quick Answer: This question evaluates data structure design and algorithmic complexity for dynamic order-statistics and update operations, focusing on maintaining current revenue and returning the bottom-K (K smallest) elements, and falls under the Coding & Algorithms domain.

Related Interview Questions

  • Maximize Throughput and Count Trigger Components - Uber (medium)
  • Replace Dashes With Nearest Letters - Uber (medium)
  • Find Earliest Column With One - Uber (easy)
  • Solve Wonderful Strings and Grid Queries - Uber (hard)
  • Count Islands After Land Additions - Uber (medium)
Uber logo
Uber
Oct 29, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0
Loading...

You are building an in-memory data structure to track customers’ current revenue and answer “top K” queries, where top K means the K smallest revenues.

Implement a class/data structure that supports:

  1. upsert(customerId, revenue) : Insert a new customer with the given revenue , or update an existing customer to this new revenue .
  2. bottomK(k) -> List[customerId] : Return the IDs of the k customers with the smallest current revenue .

Requirements / clarifications:

  • customerId is unique.
  • Revenues can repeat across customers.
  • If k is larger than the number of customers, return all customers.
  • If multiple customers have the same revenue, return them in increasing customerId order (or state and apply any deterministic tie-break).
  • Aim for efficient time complexity; be ready to discuss trade-offs for read-heavy workloads (many bottomK ) vs write-heavy workloads (many upsert ).

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Software Engineer•Uber Software Engineer•Uber 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.