Katkat

Analyze food-delivery data

CoinbaseSoftware Engineer · Onsite

Last updated

This interview question evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer for Analyze food-delivery data states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Question

You are given data for a food-delivery platform: a set of restaurants (each with a menu of items and prices, plus a geographic location) and a stream of orders (each referencing a restaurant, a set of menu items, an order total, and a timestamp). Implement the following:

  1. Cheapest and nearest restaurant. Given a desired order (a set of menu items) and the user's location, return the restaurant that can fulfill the order at the lowest total price, and the restaurant that is geographically closest to the user.

  2. Time-window order statistics. Given the menu item prices and a list of orders, compute over a given time window the total order price, the order count, and the average order value.

  3. Top-K over the window. Over the same time window, return (a) the Top-K orders ranked by total price, and (b) the Top-K menu items ranked by sales/transaction volume.