← Chicagotrading Interview Insights
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.
Execute the test suite to see which tests fail and gather error messages. This narrows down the problematic areas of the order book.
Examine the core matching engine, order insertion, and cancellation logic. Look for off-by-one errors, incorrect comparisons, or missing updates to data structures.
Use a debugger or logging to trace the execution path for a failing test. Identify the root cause and apply a minimal fix.
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.
Run the full test suite to confirm all ten tests pass. Review changes to ensure they are correct and maintain code quality.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.