LeetCode 1033. Moving Stones Until Consecutive

Problem Statement


impl Solution {
pub fn num_moves_stones(a: i32, b: i32, c: i32) -> Vec<i32> {
let mut input = vec![a, b, c];
input.sort();
if input[2] - input[0] == 2 {
return vec![0, 0];
}
let max = input[2] - input[0] - 2;
if std::cmp::min(input[1] - input[0], input[2] - input[1]) <= 2 {
return vec![1, max];
} else {
return vec![2, max];
}
}
}