c++ solution || easy || explained in comments
\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n\t//the key logic is geting as farthest element as possible from median\n 
```\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n\t//the key logic is geting as farthest element as possible from median\n        int n = arr.size();\n        sort(arr.begin(), arr.end());\n        int median = arr[(n-1)/2];\n        vector<int> ans;\n        int i = 0, j = n-1;\n        while(k != 0)\n        {\n            if(abs(arr[i] - median) > abs(arr[j] - median))\n            {\n                ans.push_back(arr[i]);\n                k--;\n                i++;\n            }\n            else if(abs(arr[i] - median) <= abs(arr[j] - median))\n            {\n                ans.push_back(arr[j]);\n                k--;\n                j--;\n            }\n        }\n        return ans;\n    }\n};\n```
[]