← All problemsSign in

Chef and mountains

Problem Statement Chef is at a mountain range . There are N mountains lined up in a straight line . Each mountain has a height h[i] . Chef is currently at mountain a and wants to go to mountain b . He can do so by jumping from mountain a to b (he is talented ) . But he can jump from a to b only if there is no mountain between a and b whose height is strictly greater than that of mountain a . In

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