they gave an example of n=100, but i doubt there will be 14 egg drops
even after getting extremely unlucky i get 8 chances (using binary search)
let us suppose the egg breaks from 100 floor
- drop from 50, doesnt break
- drops from 75, doesnt break
- drop from 87, doesnt break
- drop from 93, doesnt break
- drop from 96, doesnt break
- drop from 98, doesnt break
- drop from 99, doesnt break
- drop from 100, breaks!
where am i going wrong?
It’d be a good idea to link the question and potentially your code. There’s not enough here for anyone to go on. See How to ask good questions (and get good answers) for some great advice about what to include when asking questions .
You only have 2 eggs.
So, if the floor is 12 then your method would have broken one at 50 and one at 25 and you’d still not know which floor it was.
oh yes you are right, i just read the question again. so how to go about it then? just give a hint, not the solution. how is 14 the correct answer?
I’ve not had a proper look at it yet, but I’d guess working out why 14 is correct is likely to go along way to finding out the solution.