This "coding" question is really math problem. Once you work out the math techniques, the coding is rather simple.

My own idea — find the median of X and median of Y. If med(X) < med(Y) then discard the lower portion of X and higher portion of Y (two portions of equal size). Then repeat.

Why can’t the final "winner"be somewhere among the lower portion of X? Because the higher portion of X and higher portion Y already constitute half the population, and all of them are higher.

Definition of lower portion —

* all lower items up to but not including med(X) If len(X) is odd

* exactly the lower half of X if len(X) is even