Frog and Well Recursion


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?

Can you solve this using recursion? The method should accept 2 parameters and be called day_meter(meters, day).

Create a method called day_meter that performs this calculation.

def day_meter(meters, day) end
< >