Google classic interview questions, throwing eggs the least number of times All In One
Google classic interview questions, throwing eggs the least number of times All In One
谷歌经典面试题, 扔鸡蛋最少次数
14
✅
你在一栋 100 层的大楼里工作,你得到 2 个相同的鸡蛋。
你需要计算出鸡蛋可以掉落到最高的楼层而不破裂。
问题是你需要投掷多少次。
找到一种在最坏情况下最小化抛出次数的算法。
You work in a 100 floors building and you get 2 identical eggs.
You need to figure out the highest floor an egg can be dropped without breaking.
The question is how many throws you need to make.
Find an algorithm that is minimizing number of throws in the worst-case scenario.
https://www.freecodecamp.org/news/how-to-solve-the-google-recruiters-puzzle-about-throwing-eggs-from-a-building-de6e7ef1755d
LeetCode
https://leetcode.com/problems/super-egg-drop/
https://leetcode-cn.com/problems/super-egg-drop/
demos
The Two Egg Problem
https://code.oursky.com/famous-egg-dropping-puzzle-in-combinatorics/
https://medium.com/@khopsickle/2-eggs-and-100-floors-a032beb77aaa
http://datagenetics.com/blog/july22012/index.html
https://www.quora.com/You-have-2-eggs-You-are-on-a-100-floor-building-You-drop-the-egg-from-a-particular-floor-It-breaks-or-survives-If-it-survives-you-can-throw-the-same-egg-from-a-higher-floor-How-many-attempts-do-you-need-to-identify-the-max-floor-at-which-the-egg-doesnt-break-when-thrown-down
谷歌面试题: 扔鸡蛋
https://zhuanlan.zhihu.com/p/33898752
https://zhuanlan.zhihu.com/p/63953588
https://gist.github.com/sing1ee/5971946
https://juejin.cn/post/6877766729221537799
https://segmentfault.com/a/1190000016364846
https://juejin.cn/post/6995747344641687588
k+(k-1)+(k-2)+...+1>=100
k = 14
refs
©xgqfrms 2012-2021
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
未经授权禁止转载,违者必究!