Go solution
go\nimport "sort"\n\nfunc max(a, b int) int {\n    if a > b {\n        return a\n    } else {\n        return b\n    }\n}\n\nfunc min(a, b int) int {\n    if a 
```go\nimport "sort"\n\nfunc max(a, b int) int {\n    if a > b {\n        return a\n    } else {\n        return b\n    }\n}\n\nfunc min(a, b int) int {\n    if a > b {\n        return b\n    } else {\n        return a\n    }\n}\n\nfunc numMovesStonesII(stones []int) []int {\n    sort.Ints(stones)\n    i, n := 0, len(stones)\n    max_step := max(stones[n-1] - stones[1] - n + 2, stones[n-2] - stones[0] - n + 2)\n    \n    min_step := len(stones)\n    for j := 0; j < n; j++ {\n        for stones[j] - stones[i] >= n {\n            i++\n        }\n        if j - i + 1 == n - 1 && stones[j] - stones[i] == n - 2 {\n            min_step = min(min_step, 2)\n        } else {\n            min_step = min(min_step, n - (j - i + 1))\n        }\n    }\n    \n    return []int{min_step, max_step}\n}\n```
[]