McAfee Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
dividing into 2 sets with equal number of heads and tails easy...
divide into 2 sets first, so we will get one combination like below
set1: 6H+4T
set2: 4H+6T
if you flip all coins on one side then it will become equal number of heads and tails on both side...
but getting exactly 10heads on one side and is difficult task
For any given number, divide them into two group of equal number.
Say we have 20 Coins, and we have to divide them into 10-10's Group,
First 10 would contain say x Heads, and ( 10 - x ) tails.
while other group would contain ( 10 - x ) heads and x Tails.
Just flip one Group totally, and it would be same as the other Group. in other words,
x heads and ( 10 - x ) tails would convert into ( 10 - x ) heads and x tails. which is similar to other group.
A classic question is: Divide into two sets, such that each contains the same number of heads (note: not necessarily 10 heads each).
- Anonymous July 31, 2012Perhaps you have your own interpretation in mind and didn't really understand the actual question?