Easy C++ Solution || Two Pointers
\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        vector<int> ans;\n        int l = 0;\n        int r 
```\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        vector<int> ans;\n        int l = 0;\n        int r = arr.size()-1;\n        while(r-l+1>k){\n            if(abs(arr[l]-x)<=abs(arr[r]-x))\n            {\n                r--;\n            }\n            else{\n                l++;\n            }\n        }\n        for(int i = l;i<=r;i++){\n            ans.push_back(arr[i]);\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'C++']