Joey has to arrange 2N sandwiches which are wrapped by different color wrapper in N pairs such that he can feed his N girlfriends (A hypothetical situation it is where we have to ignore the fact “JOEY DOESN’T SHARE FOOD ”). He has to serve them for 2N-1 Days. Girls don’t like repeated pair of color wrapper of their sandwiches.

Design an algorithm for joey so that for 2N-1 days no pair would be same.

**Hint:** One can solve problem by using 2*N table.

**Solution:**

Here is one of the way to generate 2N-1 sets of different pairs efficiently. For convenience, number the different color from 1 to 2N and place these numbers in a 2N table. The pairs for the first set are given by the columns of this table. To generate the next 2N −2 sets, rotate—say, clockwise—all the entries except 1 in the last generated table.

Figure shows the example for N = 3. The entry 1 is fixed and all other entries are rotated clockwise.

**References: **The algorithm can be thought of as based on the representation change strategy. Both interpretations of the algorithm outlined above were given by Maurice Kraitchik in Mathematical Recreations [Kra53, pp. 226–227].

This puzzle is contributed by **Antara Purohit.** Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

## Recommended Posts:

- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | Elevator Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle | Man fell in well Puzzle
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)