C++ Two Pointer + Sorting
\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        sort(arr.begin(),arr.end());\n        int n=arr.size();\n        i
```\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 m=arr[(n-1)/2];\n        vector<int>ans;\n        int i=0,j=n-1;\n        int sz=0;\n        while(i<=j and sz<k){\n            if(m-arr[i]>arr[j]-m){\n                ans.push_back(arr[i]);\n                i++;\n            }else if(m-arr[i]<arr[j]-m){\n                ans.push_back(arr[j]);\n                j--;\n            }else{\n                if(arr[i]>arr[j]){\n                    ans.push_back(arr[i]);\n                    i++;\n                }else{\n                    ans.push_back(arr[j]);\n                    j--;\n                }\n            }\n            sz++;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'C', 'Sorting']