← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Google SWE interview with a market matching engine problem that looked like a coding exercise but turned into a pretty involved simulation with aggregation logic. The FizzBuzz framing is cute until you realize how many edge cases are buried in there.

Questions Asked (1)

Q1

Build a simulated matching engine where 'Fizz' orders are sells and 'Buzz' orders are buys. Orders come in FIFO priority. A match occurs when a buyer's price is at least the seller's ask. Trade price is the midpoint of the two. Process each new order greedily against the earliest compatible resting orders. Partial fills leave residual quantity. Aggregate all trades between the same buyer-seller pair into a single record with summed quantity and volume-weighted average price.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

I spent way too long on the matching loop and almost forgot about the aggregation step entirely.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then outline a data structure design that supports FIFO priority and efficient matching. Walk through the matching algorithm step-by-step, emphasizing greedy processing and aggregation, and finally discuss trade-offs and potential optimizations.

Pro tip: Demonstrate awareness of real-world matching engine constraints by mentioning latency, concurrency, and order book data structures like heaps or balanced trees, even if the problem is simplified.

1. Clarify Requirements and Edge Cases

Ask questions to confirm assumptions: order types (limit/market), price-time priority, handling of partial fills, and aggregation rules. Identify edge cases like zero quantity, crossed book, and self-trade prevention.

2. Design Data Structures

Choose data structures for the order book: separate queues for buys and sells, each maintaining FIFO order. Consider using a priority queue or sorted list for price levels to efficiently find compatible orders.

3. Outline Matching Algorithm

Describe the greedy matching process: for each new order, iterate through resting orders in FIFO order, match if prices are compatible, compute trade price as midpoint, and handle partial fills by updating quantities.

4. Aggregate Trades

Explain how to aggregate trades between the same buyer-seller pair: use a hash map keyed by (buyerId, sellerId) to accumulate total quantity and volume-weighted average price.

5. Discuss Trade-offs and Optimizations

Talk about time/space complexity, potential optimizations (e.g., price-level queues, lazy aggregation), and how the design would scale in a real system with high throughput.

Key Points to Mention

  • FIFO priority ensures fairness and is implemented via queues for each price level.
  • Greedy matching processes each incoming order against the earliest compatible resting orders.
  • Trade price is the midpoint of buyer's bid and seller's ask, ensuring fair execution.
  • Partial fills require updating residual quantities and possibly removing filled orders.
  • Aggregation uses a map to combine trades by buyer-seller pair, summing quantity and computing VWAP.
  • Consider edge cases: no match, multiple matches, and orders that match multiple resting orders.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.