There are 25 jealous people who live in the squares of a five-by-five grid. We're gonna number the squares, starting in the upper left-hand corner, 1 through 25. So the first row starts with 1, the second row starts with 6, the third row starts with 11, and so forth. Remember, each person is jealous of his adjacent neighbor. Not his diagonal neighbor, but the person up or down or left or right of him. Each aspires to move into the apartment of his adjacent neighbor.The question is very simple: What is the fewest number of total moves that can accomplish this?As stated, the answer is either 25 moves, or it is it can't be done. I don't know which yet. The reason I say it is 25 moves is that each person must move to his final apartment, which will be one of the 2, 3, or 4 apartments which are adjacent to him. The reason I say I don't know the answer yet is I have not found a one-to-one mapping that puts everybody into an adjacent apartment that is not otherwise occupied by somebody else. There is no stated restriction that in the final state each apartment must be occupied by only one person. If more than one person can occupy an apartment as long as it is one that he is jealous of, then the answer is 25 moves. Everybody in the first 4 columns moves one apartment to his right. Everybody in the 5th column moves one apartment to her left. We wind up with double occupancy of the 4th column of apartments and zero occupancy of the 1st column of apartments, but the problem as stated is solved, everybody is now in an apartment they were jealous of. R:)
Best Of |
Favorites & Replies |
Start a New Board |
My Fool |
BATS data provided in real-time. NYSE, NASDAQ and NYSEMKT data delayed 15 minutes.
Real-Time prices provided by BATS. Market data provided by Interactive Data.
Company fundamental data provided by Morningstar<