# A Puzzle

Varun Khanna

Ranch Hand

Posts: 1400

posted 13 years ago

Now this was asked in one of the interviews, here it is :

**************************************************

4 ladies (or say girls) were sitting in a room.

- One lady pointed out that difference between her age and another's (among the remaining 3) age is 1 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 2 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 3 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 4 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 5 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 6 year.

Sum of the ages of all the four ladies is 27 years.

Find out the ages of all the four ladies

(Avoid using hit and trial method.)

**************************************************

**************************************************

4 ladies (or say girls) were sitting in a room.

- One lady pointed out that difference between her age and another's (among the remaining 3) age is 1 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 2 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 3 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 4 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 5 year.

- Another lady pointed out that difference between her age and another's (among the remaining 3) age is 6 year.

Sum of the ages of all the four ladies is 27 years.

Find out the ages of all the four ladies

(Avoid using hit and trial method.)

**************************************************

- Varun

Varun Khanna

Ranch Hand

Posts: 1400

Arjun Shastry

Ranch Hand

Posts: 1899

1

Varun Khanna

Ranch Hand

Posts: 1400

Arjun Shastry

Ranch Hand

Posts: 1899

1

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

posted 13 years ago

Well, here's some logic then. If there are four numbers, there are only six different pairs that we can compare to look at the difference. (I.e. for A, B, C, D, theres |A-B|, |A-C|, |A-D|, |B-C|, |B-D|, |C-D|. So if we're looking at a list of six different differences between those four numbers, we are looking at a

x

x + 1

x + 6

or

x

x + 5

x + 6

For brevity I'm just going to talk about the first one - remember that this same logic could also be applied to the second one if needed.

Now where can we fit the one remaining number? A difference of 1 is already taken, so we can't use x+2 or x+5. If we use x+3, that would give us differences of 2, 3, and 3 - no good. Using x+4, we get differences of 3, 4, and 2 - which fills in the remaining difference reqirements nicely. Great. So, we have

x

x + 1

x + 4

x + 6

What's x? Well, the sum needs to be 27. This gives us 4x + 11 = 27, yielding x = 4. This gives results 4, 5, 8, 10 as CK posted.

What about the other possibility I skipped? Repeatiing the equivalent logic for that gives us four numbers:

x

x + 2

x + 5

x + 6

Summing these gives 4x + 13 = 27 and x = 3.5. So we could say there's a solution for 3.5, 5.5, 8.5, 9.5. However most people don't use decimals when reporting their age, so we should probably reject this one. Alternately if they do use decimals and the values are exact, this implies that all 4 girls have the same birthday, which seems unlikely but is possible in Puzzleland I suppose.

Note also that (a) there is actually some "hit and trial" lurking under the covers here; oh well; and (b) this is one of those problems that is about ten times more work to explain than it was to solve. I mean really, all I did was sketch a little number line, and most of it fell into place.

[ June 19, 2003: Message edited by: Jim Yingst ]

*complete*list. So the largest difference among these numbers is 6 - this means that the largest number is 6 more than the smallest number, and two others are in between. Where are they? Well, there's also a difference of 5 somewhere, and the only way to fit this into the range is to place a third number 5 from one end and 1 from the other end. If the smallest number is x, we have two possibilities:x

x + 1

x + 6

or

x

x + 5

x + 6

For brevity I'm just going to talk about the first one - remember that this same logic could also be applied to the second one if needed.

Now where can we fit the one remaining number? A difference of 1 is already taken, so we can't use x+2 or x+5. If we use x+3, that would give us differences of 2, 3, and 3 - no good. Using x+4, we get differences of 3, 4, and 2 - which fills in the remaining difference reqirements nicely. Great. So, we have

x

x + 1

x + 4

x + 6

What's x? Well, the sum needs to be 27. This gives us 4x + 11 = 27, yielding x = 4. This gives results 4, 5, 8, 10 as CK posted.

What about the other possibility I skipped? Repeatiing the equivalent logic for that gives us four numbers:

x

x + 2

x + 5

x + 6

Summing these gives 4x + 13 = 27 and x = 3.5. So we could say there's a solution for 3.5, 5.5, 8.5, 9.5. However most people don't use decimals when reporting their age, so we should probably reject this one. Alternately if they do use decimals and the values are exact, this implies that all 4 girls have the same birthday, which seems unlikely but is possible in Puzzleland I suppose.

Note also that (a) there is actually some "hit and trial" lurking under the covers here; oh well; and (b) this is one of those problems that is about ten times more work to explain than it was to solve. I mean really, all I did was sketch a little number line, and most of it fell into place.

[ June 19, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, *Twister*