Back to Problem Solutions forum
Hi! I am really stuck with this problem. 1. I know that we do need recursion to solve this problem 2. I know that Brute-Force algorithm does not work here,because with 20 eggs we have a lot variants. 3. I know that it important in which order the eggs are chosen. Guys please tell me what i still do not know to solve this problem:) Thanks !
All three statements are wrong:
you don't need recursion here, more simple methods will work
BF for 20 eggs could be fast enough if you really need it
order is not important - and it's a key for solution :)
Thanks a lot for suggestions , especially for # 3. Now how to check all possible variants still is a big puzzle for me
If we to use Brute-Force algorithm for this task , we have 1(from 20),2(from 20),3(from 20),4(from 20),4(from 20),...... 20(from 20), permutations. It is imposible to check this becoause of cosmic large number of possible combinations.
You don't need permutations. Use subsets. There are only 2^20 of them.