C# beat 100%
\npublic class Solution {\n    public int[] NumMovesStonesII(int[] stones) {\n        Array.Sort(stones);\n        \n        int i = 0, n = stones.Length, low =
```\npublic class Solution {\n    public int[] NumMovesStonesII(int[] stones) {\n        Array.Sort(stones);\n        \n        int i = 0, n = stones.Length, low = n;\n        int high = Math.Max(stones[n-1] - n + 2 - stones[1], stones[n-2] - stones[0] - n + 2);\n        \n        for(int j = 0; j<n; j++){\n            while(stones[j] - stones[i] >= n)\n                i++;\n            if(j - i + 1 == n - 1 && stones[j] - stones[i] == n-2)\n                low = Math.Min(low, 2);\n            else\n                low = Math.Min(low, n-(j-i+1));\n        }\n        \n        return new int[] {low, high};\n    }\n}\n\n```
[]