← All problemsSign in

Plus One

Chef has an array of integers $a[1...n]$ and he wants to perform certain number of operations (zero or more) so that all the elements of array becomes the same ( $a_1=a_2=a_3=...=a_n$ ). * In one operation, Chef can take some indices of array and increase the elements of array at those indices by 1. For example, let $a = [2,5,1,8,6]$. As an operation: he selects indices 1, 3, and 4 and increase

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