[Python3] sliding window
\n\nclass Solution:\n    def numMovesStonesII(self, stones: List[int]) -> List[int]:\n        stones.sort()\n        high = max(stones[-1] - stones[1], stones[-
\n```\nclass Solution:\n    def numMovesStonesII(self, stones: List[int]) -> List[int]:\n        stones.sort()\n        high = max(stones[-1] - stones[1], stones[-2] - stones[0]) - (len(stones) - 2)\n        \n        ii, low = 0, inf\n        for i in range(len(stones)): \n            while stones[i] - stones[ii] >= len(stones): ii += 1\n            if i - ii + 1 == stones[i] - stones[ii] + 1 == len(stones) - 1: low = min(low, 2)\n            else: low = min(low, len(stones) - (i - ii + 1))\n        return [low, high]\n```
['Python3']