✅Easy solution || ✅Short & Simple || ✅Best Method || ✅Easy-To-Understand
\n# Code\n\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        vector<pair<int, int>> v;\n        for(int
\n# Code\n```\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        vector<pair<int, int>> v;\n        for(int i=0;i<arr.size();i++)\n        v.push_back({abs(arr[i]-x), i});\n        sort(v.begin(), v.end());\n        vector<int> ans;\n        for(int i=0;i<k;i++)\n        ans.push_back(arr[v[i].second]);\n        sort(ans.begin(), ans.end());\n        return ans;\n    }\n};\n```\nPlease **UPVOTE** if it helps \u2764\uFE0F\uD83D\uDE0A\nThank You and Happy To Help You!!
['C++']