## Interview Question

Financial Software Developer Interview New York, NY

`Bloomberg L.P.`

## A frog is at the bottom of a 30 meter well. Each day he

summons enough energy for one 3 meter leap up the well. Exhausted, he then hangs there for the rest of the day. At night, while he is asleep, he slips 2 meters backwards. How many days does it take him to escape from the well?

## Interview Answer

39 Answers

28

I agree -- it's 28...because on that morning, he'll be at 27 metres and he can jump to the top in one bound.

Answer: 28

Each day he makes it up another meter, and then on the twenty seventh day he can leap three meters and climb out.

It's 29 - on the 28th day he can leap 3 meters and hang at the top (but he can't climb higher & out), and on the 29th day he'll leap and be out of the well at 31 meters.

27

At day 0, he jumps to 3m. At day 27, he jumps to 30m and gets out.

28.

Each night he ends up/starts the next morning at the number of days he's been there (first night, he's at 1 foot, 2nd night he's at two feet). Hence, on the 28th day he jumps 3 feet to 30 feet.

28 days.

At start of day 27, he jumps 3m to reach the top of the 30m well but has no energy left to climb out. At start of day 28, he jumps another 3m and entirely out of the well.

Never....the frog would be dead by day 10 since nothing to eat or drink.

28

Saying 28 is too easy. What about the external (1) and internal factors (2):

(1) there might be a heavy rain during the first night and the frog can easily float up or, ..., drown, at all;

(2) the frog may decide it's sunday - let's have a rest and spare the energy for a bigger jump on the next day...

27 days

Day 1 - It jumps 3 meters. 0 + 3 = 3.

Then falls back 2 at night. 3 - 2 = 1

Day 2 - It jumps 3 meters. 1 + 3 = 4.

Then falls back 2 at night. 4 - 2 = 2.

...

Day 26 - It jumps 3 meters. 26 + 3 = 29.

Then falls back 2 at night. 29 - 2 = 27.

Day 27 - It jumps 3 meters. 27 + 3 = 30

This question is ambiguous whether if the frog is able to get out when it reaches the top or if it needs to exceed 30 meters to climb out.

Assuming it doesn't die of starvation, the answer is 28 days.*

start of day 1 (0 days elapsed): 0m --> 3m (then falls back 2m by start of day 2)

start of day 2 (1 day elapsed): 1m --> 4m

start of day 3 (2 days elapsed): 2m --> 5m

...

start of day 28 (27 days elapsed): 27m --> 30m

start of day 29 (28 days elapsed): 28m --> 31m

In other words, 28 days will have elapsed before the frog can jump to a height exceeding 30m.*

* This answer assumes the frog is not able to walk away after it hits 30m. I would assume it has no energy left to climb out based on the problem description. If the questioner disagrees with this assumption, then the answer is 27 days.

28

27 ..... he will jump 3 meters this day to get out!!!

The math certainly says 27, assuming he only needs to get to 30m to actually get out. its easy to forget that, as pointed out by Paul, he can jump at the beginning of the day, therefore he can reach 3 meters in 0 days.

I like the out-of-the-box notions presented by HB and nic. Maybe croaking could get him some help from someone. Maybe he could get up in a well bucket. Why does he want to leave? -- maybe he has everything he needs there and is safe from predators. Why does he slip down? Can he stop that?

I wonder what they're looking for in a question like that. I wonder if it really helps them choose good candidates.

I wonder who's going to bother reading this.

No math necessary. Frog is dead after a few days.

27!! as he will be out on the same day. it will be 28 if he spends the night as well.

and c'mon, frog is not based on a binary system, that he wont have enough energy after the last 3 meter, he sure will be motivated enough to take the 3.000001 meteres on the last day to get out of the damn well.

27 days

It is 28 assuming reaching 30 ft gets him out of the well, people saying 27 are making the error of assuming there is a day zero, when counting days as with years there is no 0.

28. 27 days to get to go to sleep on level 27. Next day outa da hole.

Most frogs have to surface for air. After a short amount of time they will die without air unless they are in aerated water and can absorb through skin. So ask what species is the frog.

Day 1: 0 + 3 = 3 - 2 = 1, D2: 1 + 3 = 4 -2 = 2, D3: 2 +3 = 5 - 2 = 3....D28: 27 + 3 = 30 -2 = 28, D29: 28 + 3 = Eaten by the bird that has been waiting for him....

bllshit

If Mr. Frog manages to make it up the wall another meter everyday then, on the 27th day, he can leap three meters and climb out, the answer would be 28 days...

28 days. As the frog slips 2 meters down every night by the 27th day he has climbed 27 meters. On 28th, the frog will start from the point of 27m which means start climbing 3 meters foward and this way he reaches his 30m to get out.

28days

NB - he does 3m/day, but the result in the next morning b4 his next jump is 1m jump the previous day

In the morning of day 26 b4 he jump, he has 5m left...meaning he has done 25m for 25days.

On day 26, he jumps 3m, leaving him wit 2m to go but cos he sinks 2m overnight, the4 his resulting meters to go is 4m

On day 27, he jumps 3m and left with 1m but sinking 2m more means the resulting meters to go is 3m

On day 28, he complete his 30m and walk out from the well victorious provided no predator in the well and he didnt die of starvation

28 days...

kermit the frog?

How much water is in the well? Frogs need water to survive. What about food?

27th day

How did the frog get in the well in the first place?

What is motivating him to get up?

How does he know he can get out?

If the frog slips two meters every night for 27 nights he will be very sad and wont try anymore so he will never get out.

Wait....I am this frog!

x = number of days

A = 30 meters

x+2 = A

x + 2 = 30

x=28

Thirty days as he is only moving one meter a day.

What kind of Frog is it? Is the well full of Water? My first thought is that the frog would not survive, Food and air seem the best bet for Frog-a-cide. Of course if the question is mathematical only in nature then you would have to follow the logic above

x=number of days

y=30 meters

x+2=y

x+2=30

x=28

Hey guys ... Its simple don't break your head....

30 feet well OK

1 day 3 feet jump and sleeping and falling down to 2 feet..

So the frog can only climb up 1 feet per day...

so on 26th day it was in 26 th feet and jumped and it reached to 29th feet and sleeping and falling down to 2 feet down..

so on 27th day it was in 27th feet jumped and it reached to 30 feet and went out of the well.. bec after reaching the 30th feet why the hell does the frog gonna sleep again.

So it took 27 days for the frog to come out of the 30 feet well.

Question created by me... so answered it....lolzzzzzzzzzzz

Answer: Day 28

Day 1 - It jumps 3 meters. 0 + 3 = 3.

Then falls back 2 at night. 3 - 2 = 1

Day 2 - It jumps 3 meters. 1 + 3 = 4.

Then falls back 2 at night. 4 - 2 = 2.

...

Day 26 - It jumps 3 meters. 25 + 3 = 28.

Then falls back 2 at night. 28 - 2 = 26.

Day 27 - It jumps 3 meters. 26 + 3 = 29

Then falls back 2 at night. 29 - 2 = 27.

Day 28 - It jumps 3 meters. 27 + 3 = 30

Note: Assume after the first leap that his hind legs are exactly three meters up the well. His hind legs must clear the well for him to escape.

Answer: Day 29

Remember that on Day 1 the frog ends at 1 meter, Day 2 the frog ends at 2 meters, ... So on Day 27, the frog end at 27 meters. On Day 28, the frog goes up to 30 meters, then back down to 28 meters. On Day 29 the frog finally makes it to 31 meters (out of the well). This will help if you are still not convinced:

int height = 30;

int curPos = 0;

int days = 0;

while(curPos<=height){

days++;

curPos +=3;

if(curPos>height){

break;

}

curPos -=2;

if(curPos>height){

break;

}

}

System.out.println(days);

}

28

## Add Answers or Comments

To comment on this, Sign In or Sign Up.

try to answer this question as seriously as u can