Time: 0:00
Test a custom input to verify an edge case (e.g. empty lists, negative numbers, duplicates).
This bug belongs to the off-by-one errors pattern
The loop that runs one time too many, the slice that drops the last item, the index that starts in the wrong place.
What went wrong: the base case returns 1 for both 0 and 1, so the sequence starts 1, 1 instead of 0, 1.
The fix: if n <= 1: return n
Remember: test a recursive function on its base cases first.
The pattern behind it: off-by-one errors.
Paste this into any web page or blog post. Visitors fix the bug right there, in their browser.
<iframe src="https://trybughunt.com/embed/1dff01d3-b18d-458d-9871-b866b91bf4c0" title="Debugging challenge: AI Attempt: Fibonacci starts one step ahead" width="100%" height="580" loading="lazy" style="border:1px solid #d4d4d8;border-radius:12px;max-width:760px"></iframe>
<p style="font-size:14px">Debugging challenge from <a href="https://trybughunt.com/challenges/1dff01d3-b18d-458d-9871-b866b91bf4c0">TryBugHunt</a></p>