BEST C++ solution || Beginner-friendly approach || Beats 90% !!
Code\n\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        vector<int> ans;\n        sort(arr.begin(), arr.end());\n   
# Code\n```\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        vector<int> ans;\n        sort(arr.begin(), arr.end());\n        int a = arr.size(), m = arr[(a-1)/2], i=0, j=a-1;\n        while(i<=j){\n            if(abs(arr[i]-m) > abs(arr[j]-m))\n                ans.push_back(arr[i++]);\n            else\n                ans.push_back(arr[j--]);\n        }\n        return {ans.begin(), ans.begin()+k};\n    }\n};\n```
['C++']