Just a runnable solution
Code\n\nimpl Solution {\n    pub fn num_moves_stones_ii(stones: Vec<i32>) -> Vec<i32> {\n        let mut stones = stones;\n        stones.sort();\n        let n
# Code\n```\nimpl Solution {\n    pub fn num_moves_stones_ii(stones: Vec<i32>) -> Vec<i32> {\n        let mut stones = stones;\n        stones.sort();\n        let n = stones.len();\n        let mut i = 0;\n        let mut low = n as i32;\n        let high = std::cmp::max(stones[n - 1] - n as i32 + 2 - stones[1], stones[n - 2] - stones[0] - n as i32 + 2);\n        for j in 0..n {\n            while stones[j] - stones[i] >= n as i32 {\n                i += 1;\n            }\n            if j - i + 1 == n - 1 && stones[j] - stones[i] == n as i32 - 2 {\n                low = std::cmp::min(low, 2);\n            } else {\n                low = std::cmp::min(low, n as i32 - (j - i + 1) as i32);\n            }\n        }\n        vec![low, high]\n    }\n}\n```
['Rust']