Bloomberg L.P.

  www.bloomberg.com
  www.bloomberg.com

Interview Question

Financial Software Developer Interview New York, NY

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?
Tags:
brain teaser
Answer

Interview Answer

38 Answers

0

try to answer this question as seriously as u can

na on May 18, 2010
0

28

schubietxny on May 18, 2010
1

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.

Rebecca on May 18, 2010
0

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.

lana on May 18, 2010
1

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.

Craig on May 19, 2010
2

27

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

NK on May 19, 2010
0

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.

jmv227 on May 20, 2010
0

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.

lc on May 20, 2010
12

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

HB on May 24, 2010
0

28

Anonymous on May 28, 2010
1

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...

nic on May 29, 2010
3

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.

Cycloid on May 30, 2010
2

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.

Paul on Jun 1, 2010
0

28

satya on Jun 2, 2010
1

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

Doug on Jun 4, 2010
1

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.

Brian on Jun 5, 2010
1

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

VSBennett on Jun 6, 2010
2

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.

Waqas on Jun 7, 2010
0

27 days

Shantanu on Jun 9, 2010
0

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.

menelmacar18 on Jun 9, 2010
0

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

JC on Jun 9, 2010
0

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.

Mark on Jun 9, 2010
1

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....

AssMuncher on Jun 10, 2010
1

bllshit

don juan on Jun 10, 2010
0

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...

Deb Warren on Jun 11, 2010
0

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.

NRT on Jun 12, 2010
1

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

innovation on Jun 13, 2010
0

28 days...

Karan on Jun 14, 2010
0

kermit the frog?

omghahalol on Jun 15, 2010
0

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

Rose on Jun 15, 2010
1

27th day

Madhu on Jun 16, 2010
0

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!

BadHoodoo on Jun 16, 2010
0

x = number of days
A = 30 meters

x+2 = A
x + 2 = 30
x=28

LeonardoL on Jun 16, 2010
0

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

Anonymous on Jul 23, 2010
0

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

Stoneyzatiger on Sep 26, 2010
0

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

Dinesh 007 on Apr 8, 2012
0

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.

Sreepada on Jan 24, 2014
0

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);
    }

Anonymous on Oct 6, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.