[C++] Simple solution using two pointers
\ncpp\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        sort(arr.begin(), arr.end());\n        int left = 0;\n       
\n```cpp\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        sort(arr.begin(), arr.end());\n        int left = 0;\n        int right = arr.size()-1;\n        int midIndex = (arr.size() -1)/2;\n        int mid = arr[midIndex];\n        \n        vector<int> answer(k);\n        int counter = 0;\n        while(counter<k){\n            int leftValue = abs(arr[left]-mid);\n            int rightValue = abs(arr[right]-mid);\n            \n            if(rightValue>=leftValue){\n                answer[counter] = arr[right];\n                right--;\n            } else {\n                answer[counter] = arr[left];\n                left++;\n            }\n            counter++;\n        }\n        return answer;\n    }\n};\n```
['C', 'C++']