← All problemsSign in

ACM Preparation

Charan and Himanshu both are preparing for ACM ICPC. Now Himanshu decided to give Charan an interesting problem. An array A of N integers is given.Find the value of an Integer X such that value of expression ((A[0]-X)2+(A[1]-X)2+......+(A[N-1]-X)2) is minimum.In case there are multiple answers at which expression attains minimum value, print the maximum one. But as Charan is very busy with other

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