Minimize a wrong-match reproduction
Difficulty: Easy
Repair the buggy starter to meet this contract: Return the last index equal to target, or -1 if absent.
Test-design prompt
Reduce a long failing list to the shortest list that still distinguishes first from last.
Before editing, identify a minimal failing input and predict the result. After repairing, rerun the regression cases and explain why the old implementation failed.
Examples
[2, 1, 2], 22[], 1-1[0], 00Constraints
Inputs are JSON-compatible. Unless a tighter bound is stated, lists have at most 200 elements, strings at most 1000 characters, and integers are within -1000000..1000000. Do not mutate inputs. Use only the browser runner; no file or network access. Preserve the required function signature.
Review lesson: Build a minimal reproductionA little nudge
Reveal one hint at a time. Give yourself a moment to try it.
Worked solution
Try your own approach first, then compare the reasoning.
Complexity
Ready when you are
Write your solution, then run it against the practice tests.
Press Esc, then Tab to leave the editor. Code runs in an isolated browser workspace. Tests support learning, not verified grading.