19 years, 10 months ago
Highlights
Community contributions featuredor a little more simply:unsigned int getMaxNumberOfDrops(unsigned int floorsCount){ return (unsigned int)ceil( (sqrt( 1.0 + 8.0*floorsCount ) - 1.0) / 2.0 );}this is simply solv…
19 years, 10 months ago
19 years, 10 months ago
19 years, 10 months ago
Here is kind of a cleaned up version...int getNumberOfDrops(unsigned int floor, unsigned int topFloor){ if (floor < 1 || floor > topFloor) return -1; unsigned int step = (…
19 years, 10 months ago
That was an interesting problem. Thanks for sharing.Here's some example code demonstrating (what we have found to be) the optimal searching pattern for an arbitrary number of to…
19 years, 10 months ago
Latest Activity
See all in Discussionsor a little more simply:unsigned int getMaxNumberOfDrops(unsigned int floorsCount){ return (unsigned int)ceil( (sqrt( 1.0 + 8.0*floorsCount ) - 1.0) / …
19 years, 10 months ago
Here is kind of a cleaned up version...int getNumberOfDrops(unsigned int floor, unsigned int topFloor){ if (floor < 1 || floor …
19 years, 10 months ago
That was an interesting problem. Thanks for sharing.Here's some example code demonstrating (what we have found to be) the optimal …
19 years, 10 months ago