Amazon interview question
I remember this one question which I took time for, A frog is stuck in 10 feet deep well where the water is filled up to 5 feet in height. Every day, the frog jumps up to 2 feet high and slips 1 foot down at the end of the day. How many days will the frog take to climb out of the well?
Interview Answers
The right answer is 8 and not 3.
10-2=8
8 days to climb out of the well and 3 days to climb from the water
This question was tricky when I was trying to analyze the same and asked for 5 minutes of my time to reorganize my answer. The recruiter was calm enough and actually obliged me to do the same. I figured it out and answered the number of days would be 5 days. I did not get the answer right. He gave me another chance to prove my mettle. But I still did not get the answer right. The recruiter actually explained where I was going wrong and told me the answer. The right answer is 3 days, so, the frog is every day at 1 foot higher than it was the previous day which increases every day. The day when it is at the height of 8 feet it is out of the well as it jumps 2 feet off from that position.