Median of a list and its squares

Form the list A=[ 1,2,…,2024, 12,22,…,20242 ]A = [\,1, 2, \dots, 2024,\ 1^2, 2^2, \dots, 2024^2\,] - that is, the integers 11 through 20242024 together with their squares (40484048 numbers in all, with repeats kept). What is the median of AA?

Show hints (2)+
  1. With 40484048 numbers, the median averages the 20242024th and 20252025th smallest. Count entries ≤v\le v.
  2. That count is v+⌊v⌋v + \lfloor\sqrt v\rfloor. Solve it =2024= 2024 to find where the median sits.

Answer

Reveal answer →

1980.5

Create a free account to see the full worked solution and track your progress.

Interview format: Market Maker, Systematic & Data-Driven Trading

Related questions