closest element K | c++
class Solution { public: vector<int> findClosestElements(vector<int>& arr, int k, int x) { vector<int> arrOut; vector <int> :: iterator iterPrev, iterNext; iterPrev = find(arr.begin(), arr.end(), x); if (*iterPrev == x) { arrOut.push_back(*iterPrev); iterNext = iterPrev; iterNext++; iterPrev--; for(k; k>1; k--){ if(iterNext > arr.end() || iterPrev < arr.begin()){ arrOut.push_back(*iterPrev); iterPrev--; } ...