In this Leetcode problem, we are given an array
arr and an integer
k, we want to figure out what are the k values
v in the array such that
|v — m| is maximum with
m the median value in the array.
A simple way to resolve is if to first think about sorting the array. Indeed, it seems much easier to solve the problem once the array is sorted…