Java Simple Heap
Should be straightforward;\njust pay attention, the new defination of median makes this problem easier;\nTime:\nO(nlgN) to find the median;\nO(N), strictly O(lg
Should be straightforward;\njust pay attention, the new defination of median makes this problem easier;\nTime:\nO(nlgN) to find the median;\nO(N), strictly O(lg3 * N) = O(N), to  find result;\nSpace,\nO(k + ...) = O(k);\n```\n\tpublic int[] getStrongest(int[] arr, int k) {\n        Arrays.sort(arr);\n        int m = arr.length;\n        int med = arr[(m - 1) / 2];\n        PriorityQueue<Integer> pq = new PriorityQueue<>((b, a) -> Math.abs(b - med) == Math.abs(a - med) ? (b - a) : Math.abs(b - med) - Math.abs(a - med));\n        for (int i : arr) {\n            pq.offer(i);\n            if (pq.size() > k) pq.poll();\n        }\n        int[] res = new int[k];\n        for (int i = k - 1; i >= 0; i--) res[i] = pq.poll();\n        return res;\n    }\n```
[]