At the first end, connect pairs of wires together, leaving two wires unconnected. Go to the other end. Find a pair of connected wires, and number them #2 and #3. Find another pair and label them #4 and #5. Repeat for all of the pairs, with the last pair labeled #118 and #119. There remains two wires that are not connected to each other. Label one of these #1 and the other #120. Connect #1 to #2, #3 to #4, etc, leaving #119 and 120 unconnected. Go back to the first end. One of the originally unconnected wires still is unconnected. Label it #120 and label the other originally connected wire #1. Now find the wire connected to #1 and label it #2. The wire that originally was connected with new wire #2 can be labeled #3. The wire that is now connected to the newly labeled #3 is #4. In this way, all of the wires can be identified on both ends in two trips (one round trip). If it is necessary to disconnect the connections at the other end, a third trip is necessary.
Dave On Apr 4, 5:17 am, Munish Goyal <munish.go...@gmail.com> wrote: > Hi, > > Just posted another problem, which comes in category of hard problems. > > http://industryinterviewquestions.blogspot.com/2011/04/least-number-o... > > -- > Munish -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.