Subarray Jumps
There are $N$ stones in a pond, each having a value $A_i$ written on it. A frog is at stone $1$ and wants to reach stone $N$. The frog can jump from a stone $i$ to any stone $j (j>i)$. Let $d$ be the length of subarray (i.e. $j-i+1$), then the energy required for the jump is $(d \cdot A_i)-A_j$. Find the minimum **non-negative** amount of energy required by the frog to reach the $N$-th stone. **N
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.
Sign in to chat with the tutor and save your progress.
Sign in to start