Frog Jump - Coding Ninjas

This is also similar to Climbing stairs problem. The constraints are same except here there is a cost /energy associated with each jump. And the stairs index start from 1.

We need to find out what is the minimum amount of enery required for reaching the last step or nthn^{th}step.

Intuition

We cannot go with greedy method as it optimizes for local maxima and not global maxima

Top Down

Bottom Up

Last updated