2/13
Part 1 of 4 · Five movesLearn

Say it back, then write the examples as checks

Saying the question back in your own words is how you find what it really asks. "The first ID that appears a second time" doesn't mean the ID that comes first in the list. In [7, 3, 9, 3, 7], 7 comes first, but 3 is the first one to come back: its second copy sits at position 3, and 7's second copy only at position 4. So the answer is 3.

Predict

Say it back on your own example: what does first_repeat([5, 1, 5, 1]) return?

Pick an answer above to see the rest