谷歌面试题

转载:谷歌面试题之2 Egg Problem

为君一笑 提交于 2019-12-07 15:50:30
2 Egg Problem 继续我们的推理问题之旅,今天我们要对付的是一个Google的面试题:Two Egg Problem. 我们开始吧! No.2 Google Interview Puzzle : 2 Egg Problem * You are given 2 eggs. * You have access to a 100-storey building. * 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 分析与解答: 题目要求试的最大次数最小。首先,讨论两个比较trivial的方案。