← All problemsSign in

Bat In Cage

Problem description. Batman is trapped by Lex Luthor and given a puzzle to solve in captivity. Since Frank Miller is not here to help him, he asks you to solve the problem for him. The problem Luthor stated was "Given an array of integers, find a pair of integers x,y such that the sum of the function f(ai)=min(abs(x-ai),abs(y-ai)) over all the elements in the array is as small as possible." Inp

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