Solve the median problem.