Building an HTML5/CSS3 website that demonstrates the “2 Egg Problem” problem

Posted by & filed under Games, In English, Tech.

To my knowledge this problem has been stated as a Google Interview Puzzle:

  • You are given 2 eggs.
  • You have access to a 100-storey building (in my implementation I have chosen to use a 20 story building, simply because it fits the screen).
  • Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100th floor. Both eggs are identical.
  • You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking.
  • Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process.
A hint is that the optimal algorithm for a 20-storey (actually also 21-storey) building solves any configuration of the problem in at most 6 drops, can you find this? :)

So basically I have build a small website that enables a collaborative discussion around the problem. It was used at the open house event “åbenthus” at the Technical University of Denmark, in the beginning of this month. The website is a standalone web application which needs no special server, other than one that serves the static files. The website is hosted on my student account website at DTU and the source code can be found at a Github repository, where you can fork and build upon it.

Please let me know what you think about this tool and if you can find an optimal algorithm :)

Leave a Reply