← All problemsSign in

Hills and Valleys

Chef has N numbers from 1 to N. He calls an array of integers special if the elements initially increase then decrease or the other way i.e. initially decrease then increase. He is fasinated by such arrays as he feels that they represent hills and valleys! Given the numbers that the chef has find the number of special arrays he can form using all the numbers 1 to N. Input First line contains T

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