← All problemsSign in

Chimp And Workout

Chimp has bought N blocks each with a specific height(h1,h2,h3,….hn) for workout. Let x1,x2,…….xn be an ordering of blocks where xi represents the height of blocks . A workout is consists of N jumps, the first jump is from ground to x1, then from x1 to x2, x2 to x3 and so on till we reach xn. Difficulty of workout is defined as sum of heights of all jumps. Height of a jump is defined as |xi – xi

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