3/13
Part 1 of 4 · Five movesLearn and do

Write the plainest version that's correct

The plainest version follows the words of the question. Walk the list, and at each position look back at the IDs before it. The first ID you find among them is the answer. If the walk ends, nothing came back.

It looks at about half of all pairs, so it's slow on a long list. Write it anyway. It gets the checks passing, it gives you something to compare a faster version against, and if time runs out, a slow answer that works beats a fast one that doesn't.

ids[:j] is the part of the list before position j, and x in some_list asks whether x is anywhere in it.

In the editor, write first_repeat(ids) the plain way. The checks print ok for each example that passes.