← American Express Interview Insights

American Express·AI Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Short Karat-style debugging round for an AI Engineer role at American Express. Two parts: find and fix a bug in existing Python code by reading failing test output, then write a new function to make more tests pass. The whole thing was 20 minutes so speed of diagnosis mattered more than anything else.

Questions Asked (2)

Q1

You're given a set of Python classes and a failing test suite. Read the test output, identify which function contains the bug, explain why the test is failing, and fix it with a minimal change.

Root Cause AnalysisAlgorithms & Data Structures
Author's notes

The tricky part isn't writing code, it's resisting the urge to rewrite things.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by reading the failing test output carefully to understand the expected vs. actual behavior and trace it back to the specific function. Then explain the root cause in plain terms before proposing a minimal code change that fixes the bug without altering unrelated logic.

Pro tip: Before fixing, state your hypothesis and how you'd verify it (e.g., add a print or run a focused test), showing a systematic debugging mindset rather than guessing. Also, mention that you'd run the full test suite after the fix to ensure no regressions.

1. Parse the test output

Identify which test(s) failed, the expected result, and the actual result. Note any error messages or stack traces that point to the relevant function.

2. Trace the failure to the code

Locate the function under test and follow the execution path to find where the actual behavior diverges from the expected. Use the test input to reason through the logic.

3. Explain the root cause

Articulate why the bug occurs—e.g., off-by-one error, incorrect variable, missing edge case—and how it leads to the test failure.

4. Propose a minimal fix

Suggest the smallest code change that corrects the bug, such as adjusting a condition, changing an operator, or fixing a return value, without refactoring unrelated code.

5. Verify and prevent regression

Describe how you would test the fix: rerun the failing test, then the full suite, and consider adding a new test case if the bug was uncovered by an edge case.

Key Points to Mention

  • Read the test output carefully to understand the expected vs. actual behavior.
  • Use a systematic debugging approach: reproduce, isolate, and identify the root cause.
  • Explain the bug in simple terms before jumping to the fix.
  • Make the minimal change necessary to fix the bug, avoiding scope creep.
  • Run the full test suite after the fix to ensure no regressions.
  • Consider edge cases and whether the test suite covers them adequately.

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

Q2

Given a short spec, write a new function from scratch so that a set of currently-failing tests will pass.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Felt more comfortable here than in part one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by carefully reading the spec and the failing tests to understand the exact expected behavior, edge cases, and constraints. Then, design a clean algorithm that satisfies the spec, implement it incrementally, and run the tests frequently to validate your solution. Finally, review for efficiency and clarity, and be prepared to explain your trade-offs.

Pro tip: Before writing any code, restate the problem in your own words and confirm your understanding with the interviewer. This shows strong communication skills and prevents you from solving the wrong problem.

1. Clarify requirements and test cases

Read the spec and failing tests carefully. Identify inputs, outputs, edge cases, and any constraints. Ask clarifying questions if needed.

2. Design the algorithm

Choose an appropriate data structure and algorithm. Consider time and space complexity, and discuss trade-offs with the interviewer.

3. Implement incrementally

Write the function step by step, testing small parts as you go. Use the failing tests to guide your implementation.

4. Test and debug

Run the provided tests and any additional edge cases you can think of. Fix any issues and ensure all tests pass.

5. Review and optimize

Refactor for readability and efficiency. Explain your solution and any trade-offs you made.

Key Points to Mention

  • Understanding the spec and test expectations
  • Choosing the right data structures and algorithms
  • Time and space complexity analysis
  • Edge cases and error handling
  • Incremental development and testing
  • Code readability and maintainability

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