Concise C++ solution O(logN + k), split into larger and smaller parts
cpp\n  vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n    // split arr[] into two parts:\n    // R and above: arr[] >= x\n    // L and below
```cpp\n  vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n    // split arr[] into two parts:\n    // R and above: arr[] >= x\n    // L and below: arr[] < x\n    int R = lower_bound(arr.begin(), arr.end(), x) - arr.begin(); // O(logN)   \n    int L = R-1;\n    \n    deque<int> closest; // cloest k values to x\n    while (k--) { // O(k)\n      if (R < arr.size() && (L < 0 || arr[R] - x < x - arr[L])) \n        closest.push_back(arr[R++]); // add larger values to tail\n      else \n        closest.push_front(arr[L--]); // add smaller values to front\n    }\n    \n    return vector<int>(closest.begin(), closest.end());\n  }\n```
['Binary Search', 'C++']