Java solution - easy to understand
\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n        Arrays.sort(arr);\n        int n = arr.length;\n        int median = arr[(n - 1) 
```\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n        Arrays.sort(arr);\n        int n = arr.length;\n        int median = arr[(n - 1) / 2];\n\n        int[] res = new int[k];\n        int i = 0, l = 0, r = n - 1;\n        while (i < k) {\n            int left = Math.abs(arr[l] - median);\n            int right = Math.abs(arr[r] - median);\n            if (left <= right) {\n                res[i++] = arr[r--];\n            } else {\n                res[i++] = arr[l++];\n            }\n        }\n        return res;\n    }\n}\n```\nTime: O(nlogn)\nSpace: O(1)
[]