SIMPLE TWO-POINTER C++ SOLUTION
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:o(k)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:o(k)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n       sort(arr.begin(), arr.end());\n        int n = arr.size();\n        int median = arr[(n - 1) / 2];\n        int left = 0;\n        int right = n - 1;\n        vector<int>result;\n        for(int i=0; i<k; i++){// we only need k elements \n            if (abs(arr[right] - median) >= abs(arr[left] - median)) {// if both are equal we need to select the higher one ,if greater select right as defualt\n                // right will be always higher (bcoz we already sorted)\n                result.push_back(arr[right]);\n                right--;\n            }else{\n                result.push_back(arr[left]);\n                left++;\n            }\n        }\n        \n        return result;\n    }\n};\n```
['C++']