Skip to content

Commit ffea424

Browse files
authored
Update README.markdown
1 parent 082385a commit ffea424

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Egg Drop Problem/README.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Egg Drop Dynamic Problem
22

3-
# Problem Description
3+
## Problem Description
44

55
Given some number of floors and some number of eggs, what is the minimum number of attempts it will take to find out from which floor egg will break.
66

@@ -15,7 +15,7 @@ Suppose that we wish to know which stories in a 36-story building are safe to dr
1515
If only one egg is available and we wish to be sure of obtaining the right result, the experiment can be carried out in only one way. Drop the egg from the first-floor window; if it survives, drop it from the second floor window. Continue upward until it breaks. In the worst case, this method may require 36 droppings. Suppose 2 eggs are available. What is the least number of egg-droppings that is guaranteed to work in all cases?
1616
The problem is not actually to find the critical floor, but merely to decide floors from which eggs should be dropped so that total number of trials are minimized.
1717

18-
# Solution
18+
## Solution
1919
- eggNumber -> Number of eggs at the moment
2020
- floorNumber -> Floor number at the moment
2121
- visitingFloor -> Floor being visited at the moment
@@ -50,7 +50,7 @@ if attempts < eggFloor[eggNumber][floorNumber]{ //finding the min
5050
eggFloor[eggNumber][floorNumber] = attempts;
5151
}
5252
```
53-
Example:
53+
## Example
5454
Let's assume we have 2 eggs and 2 floors.
5555
1) We drop one egg from the first floor. If it breaks, then we get the answer. If it doesn't we'll have 2 eggs and 1 floors to work with.
5656
attempts = 1 + maximum of 0(got the answer) and eggFloor[2][1] (base case 2 which gives us 1)

0 commit comments

Comments
 (0)