C++ Simple and Easy 5-Line Solution, O(n) No Binary Search
\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        int left = 0, right = arr.size()-1;\n        \n     
```\nclass Solution {\npublic:\n    vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n        int left = 0, right = arr.size()-1;\n        \n        while (right - left + 1 > k) {\n            \n            if (arr[right] - x < x - arr[left]) left++;\n            else right--;\n        }\n        \n        return vector<int>(arr.begin() + left, arr.begin() + right + 1);\n        \n    }\n};\n```\n**Like it? please upvote!**
['C']