Why not right definition of median
median = A[(n - 1) / 2] ??\n\nNo, why did leetcode define median itself....\n\nmedian = (A[n/2] + A[(n-1)/2]) / 2\n\nPlease noted that that\'s universal definit
`median = A[(n - 1) / 2]` ??\n\nNo, why did leetcode define median itself....\n\n`median = (A[n/2] + A[(n-1)/2]) / 2`\n\nPlease noted that that\'s universal definition of "median"\n\nTime `O(nlogn)`\nSpace `O(n)`\n\n**C++**\n```cpp\n    vector<int> getStrongest(vector<int> A, int k) {\n        sort(A.begin(), A.end());\n        int n = A.size(), i = 0, j = n - 1, m = A[(n - 1) / 2];\n        while (k--) {\n            if (A[j] - m >= m - A[i])\n                j--;\n            else\n                i++;\n        }\n        A.erase(A.begin() + i, A.begin() + j + 1);\n        return A;\n    }\n```
[]