← All problemsSign in

Max M(keteki)

Given an array of numbers, a number M is selected and in odd number positions M is added to the array while in even number positions M is subtracted. Positions here is 1 based index. Print the maximum M that can be selected such that after doing the addition and subtraction operation as stated above to all the array, the array is in ascending order. Print -1 if such a number is impossible to be

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