C++ slide window
```\nclass Solution {\npublic:\n   vector numMovesStonesII(vector& stones) {\n      sort(stones.begin(), stones.end());\n      return { minMove(stones), maxMove
```\nclass Solution {\npublic:\n   vector<int> numMovesStonesII(vector<int>& stones) {\n      sort(stones.begin(), stones.end());\n      return { minMove(stones), maxMove(stones) };\n   }\n\n   int maxMove(vector<int>& v) {\n      const int n = v.size();\n      int left = v[1] - v[0] - 1;\n      int right = v[n - 1] - v[n - 2] - 1;\n      int total_interval = v[n - 1] - v[0] - n + 1;\n      return total_interval - min(left, right);\n   }\n\n   int minMove(vector<int>& v) {\n      int l = 0, r = 1, minMove = v.size();\n      while (r < v.size()) {\n         int interval = v[r] - v[l] - (r - l);\n         int numStoneOutsideLR = v.size() - (r - l + 1);\n         if (numStoneOutsideLR >= interval) {\n            if (numStoneOutsideLR == 1 && interval == 0)\n               minMove = min(minMove, 2); //shit corner case\n            else\n               minMove = min(minMove, numStoneOutsideLR);\n            r++;\n         }\n         else {\n            l++;\n         }\n      }\n      return minMove;\n   }\n};
[]