solulubeta
Sign in
Recursion & Memo / From recursion to memoization
03.05 · Problem

Frog Jump With K Steps

Medium 1-D DP with a loop of choices Pro

The same frog, but from stone i it can jump to any stone from i + 1 to i + k. Return the smallest total cost. If you worked out Frog Jump, this is a two-line change.

Examples

Example 1

Input:  heights = [10, 30, 40, 50, 20], k = 3
Output: 30

0 → 1 (cost 20) → 4 (cost 10) = 30.

solulu Pro

Continue this problem with Pro

Inside: step-by-step hints · 10 hidden tests · reference solutions · code editor.

Lifetime ₹1,999 ₹999 · Launch offer
Mark this problem as solved when you are finished.

Item 24 of 44 · updated 2026-10-13