← Chicagotrading Interview Insights

Chicagotrading·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

C++ debugging round at Chicago Trading. One question, ten test cases, two bugs to find. More reading than coding, which I did not expect going in.

Questions Asked (1)

Q1

You are given a C++ order book implementation with ten test cases. Find and fix exactly two bugs so that all ten tests pass.

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

Way more reading than I anticipated.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by running the test suite to identify which tests fail, then systematically debug the order book logic, focusing on common pitfalls like price-time priority, order matching, and data structure invariants. After fixing the first bug, re-run tests to isolate the second bug, ensuring each fix is minimal and doesn't break other tests.

Pro tip: Demonstrate a methodical debugging process: use print statements or a debugger to trace order flow, and consider edge cases like empty book, partial fills, and cancel/replace operations. This shows you can handle production-level code under time pressure.

1. Run Tests and Identify Failures

Execute the test suite to see which tests fail and gather error messages. This narrows down the problematic areas of the order book.

2. Review Order Book Logic

Examine the core matching engine, order insertion, and cancellation logic. Look for off-by-one errors, incorrect comparisons, or missing updates to data structures.

3. Debug First Bug

Use a debugger or logging to trace the execution path for a failing test. Identify the root cause and apply a minimal fix.

4. Re-run Tests and Debug Second Bug

After fixing the first bug, re-run tests to see remaining failures. Repeat the debugging process for the second bug, ensuring the first fix didn't introduce new issues.

5. Verify All Tests Pass

Run the full test suite to confirm all ten tests pass. Review changes to ensure they are correct and maintain code quality.

Key Points to Mention

  • Price-time priority: orders should match at the best price, and at the same price, earlier orders have priority.
  • Data structure invariants: e.g., bids sorted descending, asks ascending, and order quantities updated correctly after partial fills.
  • Edge cases: empty book, single order, exact match, partial fill, cancel non-existent order, and order replacement.
  • Concurrency considerations: if the order book is multi-threaded, ensure proper locking or lock-free design to avoid race conditions.
  • Testing methodology: use unit tests to isolate bugs, and consider adding temporary debug output to trace order flow.
  • Code review: after fixing, review changes for potential side effects and ensure they align with the intended behavior.

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