top of page

Code Challenge #8

Updated: Dec 15, 2023

You are given N identical eggs and access to a building with k floors. Your task is to find the lowest floor that will cause an egg to break, if dropped from that floor.

Code Challenge

Once an egg breaks, it cannot be dropped again. If an egg breaks when dropped from the xth floor, you can assume it will also break when dropped from any floor greater than x.


Write an algorithm that finds the minimum number of trial drops it will take, in the worst case, to identify this floor.


For example, if N = 1 and k = 5, we will need to try dropping the egg at every floor, beginning with the first, until we reach the fifth floor, so our solution will be 5.


Head over to this link to solve the problem.

Comments

Rated 0 out of 5 stars.
No ratings yet

Commenting on this post isn't available anymore. Contact the site owner for more info.

Subscribe to get exclusive updates

Thanks for subscribing!

CONTACT ME
avatar-formal-round.png

Follow

  • Medium
  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
  • Youtube
  • Paypal.Me
  • linktree

© 2019 - 2025 Biyi Akinpelu. The LORD Is My Banner

bottom of page