← 返回 perplexity 的题目列表Fix Existing Code (Bug Fixing)
类型:online_judge
Fix Existing Code (Bug Fix)
You are given an existing piece of code and some failing test cases (or hidden tests). The code is intended to implement a specified behavior but contains one or more bugs.
Task
Fix the code with minimal changes so that all tests pass.
Explain how you locate the issue (e.g., adding logs, constructing counterexamples, reasoning about edge cases).
Input/Output
The interviewer provides the code and a test harness (usually a function signature).
Your function must return correct results for the full input domain.
Constraints
Pay special attention to edge cases (empty input, extremes, duplicates, malformed input, etc.).
Note: Original details are missing; the above is a faithful restatement of the common interview format.