A frog is at the bottom of a 17-foot well. Each time the frog leaps, it moves up 3 feet. If the frog has not reached the top of the well, then the frog slides back 1 foot before it is ready to make another leap.
At the end of each leap, the frog will have noved up 3 feet and moved back 1 foot, which is, in effect, a movement of 2 feet.
After 7 leaps, the frog will have moved a total of 7 * 2 = 14 feet.
Another leap will take it up another 3 feet, which means it will have reached 17 feet, before it needs to move back.
But, of course, after 17 feet it will have reached the top of the well and will immediately escape. So all ends well.
Answer: the frog needs 8 leaps to escape the well