Nearest Court
Chef and Chefina are at positions $X$ and $Y$ on a number line. They both love badminton. It is known that badminton courts are located at every integer point. They want to find a court such that the *maximum* distance travelled by either of them is **minimized**. Formally, suppose they choose the badminton court at position $Z$. You need to find the minimum value of $\max(|X-Z|, |Y-Z|)$ acros
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