Time: 0:00
This is a logic errors bug
The wrong operator, an inverted condition, a formula the right way round but backwards.
Sorting and taking the second-last item finds the second-highest position, not the second-highest value. When two players tie for first, the top two positions hold the same score. Remove duplicates first with set(), then sort, so each score appears once. The AI's version passes every test without ties, which is exactly why ties are the first edge case an interviewer asks about. When a problem says distinct, ask what happens with duplicates.
The pattern behind it: logic 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/e12dc04c-afdc-46d0-8832-cc5caff354da" title="Debugging challenge: AI Attempt: The runner-up finder" 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/e12dc04c-afdc-46d0-8832-cc5caff354da">BugHunt</a></p>