Minimize the Equation
CodeChefOpen on judge ↗
Joey is given a problem by his friend Chandler. Since he is not good in maths, he told you to help him solve the problem. Can you help Joey to solve the problem. The problem is that given an array A with N integers, A[0], A[1], A[2], ... , A[N-1], you need to find an integer x, such that the expression (A[0] - x)2 + (A[1] - x)2 + ... + (A[N-1] - x)2 is minimum possible. Input - The first line c
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.
Sign in to chat with the tutor and save your progress.
Sign in to start