Coinbase·Software Engineer·Technical Phone Screen
- Given a user's location and a set of restaurants with their menu items and prices, find the restaurant with the lowest total cost for a given basket. If there's a tie on price, return the nearest one. You need to define how you compute distance.
- Given a stream of orders with timestamps and per-item prices, compute total revenue, order count, and average order value over a sliding time window. The solution needs to support multiple overlapping windows efficiently.
- Within a time window, return the top K orders by total price and the top K items by units sold. The data updates in real time, so the solution needs to handle insertions and recalculations efficiently. Discuss data structures, complexity, and how you handle ties.
“The distance part tripped me up more than the pricing logic.”