← All problemsSign in

Cat Jump

The cat wants to Climb some stairs from the 0th stair to the (N-1)th stair. Given the number of stairs $N$ and the height of each stair. The cat is allowed to jump up to ‘K’ steps at a time. If K=4, the cat can jump 1,2,3, or 4 steps at every index. A height[N] array is also given. Whenever the cat jumps from a stair i to stair j, the energy consumed in the jump is abs(height[i]- height[j]), where

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start