Identifying wires in a long tunnel
Asked at Jane Street, Optiver, Citadel
A bundle of identical wires runs through a long tunnel from end A to end B. The wires are indistinguishable, and you cannot tell which strand at A corresponds to which strand at B. At each end you may tie wires together (shorting them) and you have a battery-and-bulb continuity tester to check which wires are electrically connected. Walking through the tunnel is slow.
Devise a scheme to correctly label all wires at both ends. Minimize the number of tunnel traversals (trips between A and B).
Show a hint
Tying wires into groups of different sizes at one end creates a signature you can read at the other end using continuity tests. What group sizes are all distinguishable?
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.