← All problemsSign in

Tricky Array

You are given an array $A$ containing $N$ elements and the elements are denoted by $A[i]$ (*1<=i<=N*). The elements can be positive, negative or zero. An integer $X$ is also given. You have to perform the following operation exactly one time. - Add $X$ to $A[i]$ and subtract $X$ from $A[j]$ such that **i!= j** (i not equal to j). You have to perform the given operation in such a way that af

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