PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Coinbase

Compute prices, distances, and Top-K for orders

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem solving and data-structure design for spatial queries, price lookup, time-windowed revenue aggregation, and Top-K computation, including reasoning about tie-breaking and computational complexity.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Compute prices, distances, and Top-K for orders

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Build functions for a food‑delivery analytics module. Data: - Restaurants: id, (x, y) location, menu mapping item -> price. - Orders: id, restaurantId, timestamp (Unix ms), line items: (item, quantity). Tasks: (a) Given the user's (x, y) and a target item, return the restaurant (s) offering the lowest price for that item and, among ties, the nearest by Euclidean distance (return id and distance). (b) For a time window [start, end), compute total revenue, order count, and average order value. (c) For a time window [start, end), return Top K orders by total price (id, total) and Top K items by quantity sold (item, quantity). Specify tie‑breaking rules, chosen data structures, and complexity.

Quick Answer: This question evaluates algorithmic problem solving and data-structure design for spatial queries, price lookup, time-windowed revenue aggregation, and Top-K computation, including reasoning about tie-breaking and computational complexity.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Jul 31, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
6
0

Build functions for a food‑delivery analytics module. Data:

  • Restaurants: id, (x, y) location, menu mapping item -> price.
  • Orders: id, restaurantId, timestamp (Unix ms), line items: (item, quantity). Tasks: (a) Given the user's (x, y) and a target item, return the restaurant (s) offering the lowest price for that item and, among ties, the nearest by Euclidean distance (return id and distance). (b) For a time window [start, end), compute total revenue, order count, and average order value. (c) For a time window [start, end), return Top K orders by total price (id, total) and Top K items by quantity sold (item, quantity). Specify tie‑breaking rules, chosen data structures, and complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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

Master your tech interviews with 7,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.