two pointers
\nvector<int> getStrongest(vector<int>& arr, int k) {\n    vector<int> ans;\n    int n = arr.size();\n    sort(arr.begin(), arr.end());\n    int m_idx = (n - 1)
```\nvector<int> getStrongest(vector<int>& arr, int k) {\n    vector<int> ans;\n    int n = arr.size();\n    sort(arr.begin(), arr.end());\n    int m_idx = (n - 1) >> 1;\n    int m = arr[m_idx];\n    int i = 0;\n    int j = n-1;\n    while (k--) {\n        if (m - arr[i] < arr[j] - m) {\n            ans.push_back(arr[j]);\n            --j;\n        } else if (m - arr[i] > arr[j] - m) {\n            ans.push_back(arr[i]);\n            ++i;\n        } else {\n            ans.push_back(arr[j]);\n            --j;\n        }\n    }\n    return ans;\n}\n```
[]