C++ | Sorting using lambda function | With comments
\n\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        sort(arr.begin(),arr.end());    //sort to find the median\n     
\n```\nclass Solution {\npublic:\n    vector<int> getStrongest(vector<int>& arr, int k) {\n        sort(arr.begin(),arr.end());    //sort to find the median\n        int n=arr.size();\n        int med=arr[(n-1)/2];    //median\n        \n        sort(arr.begin(),arr.end(),[med](int &a,int &b){    //sorting using lambda function\n            if(abs(a-med)==abs(b-med))\n                return a>b;\n            return abs(a-med)>abs(b-med); \n        });\n        \n        return vector<int>(arr.begin(),arr.begin()+k);    //return vector slice of size k\n    }\n};\n```\n##### Please upvote if you like my solution.\n*Feel free to share your opinion*
['C', 'Sorting']