The tricky part wasn't finding the bug, it was orienting myself in code I'd never seen before.
First, run the failing tests to understand the expected vs actual behavior, then use the AI assistant to trace the code path and identify the bug. After fixing, re-run tests and add edge cases to ensure robustness.
Pro tip: Treat the AI as a pair programmer: ask it to explain the code's logic and suggest hypotheses, but always verify its fixes with tests and your own reasoning.
Run the test suite to see which tests fail and what the expected output is. Read the failing test cases to understand the maze setup and the solver's incorrect behavior.
Use the AI assistant to summarize the maze solver's algorithm and identify potential issues. Ask it to explain the traversal logic, boundary checks, and path reconstruction.
Based on the analysis, hypothesize the root cause (e.g., off-by-one error, incorrect neighbor iteration, missing visited check). Use the AI to suggest fixes, but validate each with targeted test runs.
Apply the fix, ensuring it addresses the root cause without breaking other functionality. Re-run all tests, including edge cases like no path, start equals end, and large mazes.
Summarize the bug, the fix, and how you used the AI assistant effectively. Highlight any lessons learned about debugging or the algorithm.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.