100% Simple two-pointer O(n) time c++ solution (No additional O(logn))
\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        int i = 0;\n        int j = arr.size()-1;\n        w
```\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        int i = 0;\n        int j = arr.size()-1;\n        while(j - i + 1 > k) {\n            if(x - arr[i] > arr[j] - x) i++;\n            else j--;\n        }\n        return vector<int>(&arr[i], &arr[j+1]);\n    }\n};\n```
[]