O(Nlog(N)) JAVA solution!
\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n           Arrays.sort(arr);\n           int[] res = new int[k];\n           int[] nums =
```\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n           Arrays.sort(arr);\n           int[] res = new int[k];\n           int[] nums = arr;\n           int mid_index = (nums.length-1)/2;\n           int median = arr[mid_index];\n           \n           int i = 0;\n           int j = nums.length-1;\n           \n\n           int count = 0;\n           while(i<=j){\n                int left = nums[i];\n                int right = nums[j];\n               \n                if(Math.abs((long)left-median)>Math.abs((long)right-median)){\n                    count++;\n                    res[count-1] = left;\n                    i++;\n                }else{\n                    count++;\n                    res[count-1] = right;\n                    j--;\n                }\n                if(count == k){\n                    break;\n                }\n           }\n        \n          \n        \n           return res;\n    }\n}\n```
[]