← All problemsSign in

Jumps

Jhonny wants to cross a river with minimal energy and he is bit tired so can only make a jump of length L. He is lucky that the river is magical as each stone has a power associated with it which means if Jhonny lands on ith stone which has power A[i] then he can make another jump of A[i] length. Currently, Jhonny is on left side of river and wants to cross the river. Print the minimum length of i

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