
|
technical riddles
The problem is can be viewed <a href='http://www.techinterview.org/Puzzles/fog0000000169.html'>here</a>.
You might be able to do this with Gray-codes. That was actually invented for the following purpose: generate a sequence of numbers where each subsequent elements only differs by one bit in binary representation. (This is the 'move one person per turn' stuff) This is suppoesedly quite a nice in electronics: otherwise you would have 'wrong' values for a short time when transitioning from a number to the next if not all bits change at exactly the same time.
The Gray-sequence is starts out like this:
0
1
11
10
110
111
101
100
1100
1101
1111
1110
1010
1011
1001
1000
11000
etc
I suppose all combination are used, though I don't remember a proof.
Hoping not to have done anything stupid (I'm new here),
Thomas van Dijk
Thomas van Dijk
Wednesday, July 10, 2002
Recent Topics
Fog Creek Home
|