← All problemsSign in

MaxMin Difference

In each test case, you are given an array (A1..An). You are also given a closed interval [L,U]. You want to find an integer X between L and U (both are inclusive) such that minimum( |Ai-X| for 1<=i<=n) is maximised. Report the smallest X if multiple answers. Size of the array(n) can go upto 100. 1 <= Ai,L,U <= 10^9 i/p format: n A1..An L U o/p format: Result followed by a newline character. S

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