C++ [Easy]
\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        if(arr.size() == 1) return arr;\n        sort(arr.begin(), arr.end
```\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        if(arr.size() == 1) return arr;\n        sort(arr.begin(), arr.end());\n        vector<int> ans;\n        int len = arr.size();\n        int medPos = (len-1)/2;\n        int med = arr[medPos];\n        vector< pair<int, int>> m;\n        for(int i = 0; i < len; i++)\n            m.push_back(make_pair(abs(arr[i] - med), arr[i]));\n        sort(m.begin(), m.end(), [](const pair<int,int> &a, const pair<int,int> &b) {\n            if(a.first == b.first)\n                return a.second > b.second;\n            return (a.first > b.first);\n        });\n        int i = 0;\n        for(auto it = m.begin(); i < k; it++, i++)\n            ans.push_back(it->second);\n        return ans;\n    }\n};\n```
[]