Interview Question
Financial Software Developer Interview

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 Answers
66 Answers
Never....the frog would be dead by day 10 since nothing to eat or drink.
HB on
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
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
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
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
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(curPosheight){ break; } curPos =2; if(curPos>height){ break; } } System.out.println(days); }
Anonymous on
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
Thirty days as he is only moving one meter a day.
Anonymous on
It'll take the frog 27 days to climb out of the well. The well is 30m, he can climb 3m/day but slides down to 1m/night. So, he only has accomplished 1m/day. On the 27th day, he will then be able to jump the 3m out of the well. *Frogs can go up to 34 weeks without food or water, so it would be pushing the limits on that. However, he's in a well and I'm sure there would be little insects in there for it to eat. Wells are also usually damp, so his back quarters will stay moist.*
Carrie Chance in Louisville, KY on
27th day
Madhu on
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
28
satya on
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
28
schubietxny on
28
Anonymous on
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
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
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
28. 27 days to get to go to sleep on level 27. Next day outa da hole.
JC on
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
27 days
Shantanu on
28
Anonymous on
ITS ONLY 10 DAYS. Because, if he waits 10 days, he will summon the strength to jump 30 meters in one jump to the top of the well. Ya'll can't think outside the box...
Anonymous on
28
area on
28
Anonymous on
I know this isn't the right answer but if u think VERY VERY logically, well, he doesn't.
Gb on
28
wale on
Every day there is 3 feet of effort, but only one foot of progress. On day 26 the frog jumps to 29 feet. Almost making it out. Just a foot away from the top. On the night of the 26th it slides down 2 feet. 29ft 2ft=27 feet, but it is still the 26th at night. On the 27th "day" the frog jumps up 3 feet. 27ft+3ft=30 feet. The top is 30 feet.
27 days to reach the "top"! on
d= number of days Y=d3d23 27m=d(32) 27m/1=d
Jayne on
39
nnn on
Day 1 > Total distance Covered = 32 = 1m Day 27 > 1*27 = 27 Day 28 > 27+3 = 30 and the frog and he escapes
Shravan Honade on
28 will be the final answer
Anonymous on
I agree with Rebecca. It's most likely to be 28
Subitha on
28 Days, provided Frog doesn't die Starving.
Rehan on
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? Day 1: 32 = 1m Day 2: 4  2= 2m So on, so forth... It take the frog 30 days to get out of the 30 meter well.
Samantha Chisholm on
Because of the 3 meter jump per day, on day 27, starting at meter 27 + 3 meters = 30. No resting required on day 27.
27 on
27, on day 26 he will leap to 29 slide back to 27 so on day 27 he will be at the top
Rita Stone on
10
Cristian on
28, Do we play with blocks and get juice boxes latter?
Anonymous on
It would take the frog 30 days
Anonymous on
30 days
Mohammad Wamiq on
it has got to be 30 days, cause everyday he really only moves 1 meter, 1 meter everyday is 30 meters
aiden on
30
Anonymous on
30
Anonymous on
1 because he is in the hole until he isn't in the hole anymore. If his motivation was escape he wouldn't be sleeping and falling behind so much.
Matthew Seed on
30 days
Aaron Dooley on
28 days is the correct answer.
Taylor Ingles on
28 days is the correct answer.
Taylor Ingles on
I figure about 11 days, first day 3 meters and he slips to 1, the next day realizing that he slips each day he uses his sticky tongue and attaches it to something solid on the wall of the well, when he wakes in the morning he simply jumps another 3 meters, and continues this process until he can evacuate the well.
JJ on
27 to the rim, 28 1m out of the rim of the well.
Vanessa on
Frog must travel 30m. Makes progress of 3 meters in the day and loses 2m at night with total progress of 1 meter per 24 hours. Taking the frog 30 full days, (Day and night) to escape.
3 steps foward, 2 step back. on
x = number of days A = 30 meters x+2 = A x + 2 = 30 x=28
LeonardoL on
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 Frogacide. 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
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
30 days
nithes on
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
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
28 days...
Karan on
27 At day 0, he jumps to 3m. At day 27, he jumps to 30m and gets out.
NK on
No math necessary. Frog is dead after a few days.
VSBennett on
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
try to answer this question as seriously as u can
na on
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
27 ..... he will jump 3 meters this day to get out!!!
Doug on
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 outofthebox 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
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