[Java/Python 3] Two codes: Two Pointer and PriorityQueue w/ brief explanation and analysis.
First sort then \nMethod 1:\nUse Two Pointer: \n1. starts from the two ends of the sorted array, choose the stronger one and move the corresponding pointer;\n2.
First sort then \n**Method 1:**\nUse Two Pointer: \n1. starts from the two ends of the sorted array, choose the stronger one and move the corresponding pointer;\n2.  repeats the above till get k elements.\n\n```java\n    public int[] getStrongest(int[] arr, int k) {\n        int n = arr.length, i = 0, j = n - 1;\n        Arrays.sort(arr);\n        int median = arr[(n - 1) / 2];\n        int[] ans = new int[k];\n        while (k-- > 0) {\n            if (median - arr[i] > arr[j] - median) {\n                ans[k] = arr[i++];\n            }else {\n                ans[k] = arr[j--];\n            }\n        }\n        return ans;\n    }\n```\n```python\n    def getStrongest(self, arr: List[int], k: int) -> List[int]:\n        arr.sort()\n        n = len(arr)\n        median, i, j = arr[(n - 1) // 2], 0, n - 1 \n        while k > 0:\n            if median - arr[i] > arr[j] - median:\n                i += 1\n            else:\n                j -= 1\n            k -= 1\n        return arr[: i] + arr[j + 1 :]\n```\n**Analysis:**\nSorting is the major part for time, which cost (n); returned array cost space O(k). Therefore,\nTime: O(nlogn), space: O(k) - including returned array.\n\n----\n\n**Method 2:**\ntraverse `arr`, use PriorityQueue to maintain the currently k strongest.\n```java\n    public int[] getStrongest(int[] arr, int k) {\n        int n = arr.length;\n        Arrays.sort(arr);\n        int median = arr[(n - 1) / 2];\n        PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);\n        for (int a : arr) {\n            pq.offer(new int[]{Math.abs(a - median), a});\n            if (pq.size() > k) {\n                pq.poll();\n            }\n        }\n        return pq.stream().mapToInt(a -> a[1]).toArray();\n    }\n```\n```python\nfrom queue import PriorityQueue\n\nclass Solution:\n    def getStrongest(self, arr: List[int], k: int) -> List[int]:\n        median = sorted(arr)[(len(arr) - 1) // 2]\n        pq = PriorityQueue()\n        for i, a in enumerate(arr):\n            pq.put((abs(a - median), a))\n            if i >= k:\n                pq.get()\n        return [pq.get()[1] for _ in range(k)]\n```\n**Analysis:**\nSorting is the major part for time, which cost (n); PriorityQueue cost space O(k). Therefore,\nTime: O(nlogn), space: O(k).
[]