← All problemsSign in

Can you reach

CodeChefRating 1697Open on judge ↗

A certain mountain range has $N$ mountains, all along a line. The peak of the $i$-th mountain is at a height of $H_i$. It is known that adjacent mountain peaks differ in height by exactly $1$, i.e. $|H_i - H_{i-1}| = 1$ for every $i$. On each mountain peak lives a single person. A person can move from one mountain peak to an adjacent mountain peak (i.e. a person standing on the $i$-th peak ca

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