There are three stones in different positions on the X-axis. You are given three integers a, b, and c, the positions of the stones.

In one move, you pick up a stone at an endpoint (i.e., either the lowest or highest position stone), and move it to an unoccupied position between those endpoints. Formally, let's say the stones are currently at positions x, y, and z with x &lt; y &lt; z. You pick up the stone at either position x or position z, and move that stone to an integer position k, with x &lt; k &lt; z and k != y.

The game ends when you cannot make any more moves (i.e., the stones are in three consecutive positions).

Return an integer array answer of length 2 where:


	answer[0] is the minimum number of moves you can play, and
	answer[1] is the maximum number of moves you can play.


&nbsp;
Example 1:

Input: a = 1, b = 2, c = 5
Output: [1,2]
Explanation: Move the stone from 5 to 3, or move the stone from 5 to 4 to 3.


Example 2:

Input: a = 4, b = 3, c = 2
Output: [0,0]
Explanation: We cannot make any moves.


Example 3:

Input: a = 3, b = 5, c = 1
Output: [1,2]
Explanation: Move the stone from 1 to 4; or move the stone from 1 to 2 to 4.


&nbsp;
Constraints:


	1 &lt;= a, b, c &lt;= 100
	a, b, and c have different values.


class Solution:
    def numMovesStones(self, a: int, b: int, c: int) -> List[int]:
        a,b,c = sorted([a,b,c])
        d1 = abs(b-a)-1 
        d2 = abs(c-b)-1
        mi = 2
        if d1 == 0 and d2 == 0: mi = 0
        elif d1 <= 1 or d2 <= 1: mi =1    
        ma = c - a - 2
        return [mi,ma]
class Solution {
    public int[] numMovesStones(int a, int b, int c) {
        int[] arr ={a,b,c};
        int[] arr2 = {a,b,c};
        int maximum = findMaximum(arr);
        int minimum = findMinimum(maximum,arr2);
        return new int[]{minimum,maximum};
    }
    public int findMaximum(int[] arr){
        Arrays.sort(arr);
        int count = 0;
        if(arr[0] == (arr[1]-1) && arr[1] == (arr[2] -1) ) return count;
        if(arr[0] == arr[1]-1){
            arr[2]--;
            count++;
        }
        else{
            arr[0]++;
            count++;
        }
        return count + findMaximum(arr);

    }

    public int findMinimum(int max,int[] arr){
        Arrays.sort(arr);
        if(max == 0) return 0;
        else if(Math.abs(arr[0]-arr[1]) >2 && Math.abs(arr[1]-arr[2]) >2 ) return 2;
        else return 1;
    }
}
class Solution {
public:

    vector<int> numMovesStones(int a, int b, int c) {

        vector<int> arr = {a, b, c};

        sort(arr.begin(), arr.end());

        // find minimum moves

        int mini = 0;

        if(arr[1] - arr[0] == 1 && arr[2] - arr[1] == 1)
        {
            mini = 0;
        }
        else if(arr[1] - arr[0] <= 2 || arr[2] - arr[1] <= 2)
        {
            mini = 1;
        }
        else
        {
            mini = 2;
        }

        // find maximum moves

        int maxi = (arr[1] - arr[0] - 1) + (arr[2] - arr[1] - 1);

        return {mini, maxi};
    }
};
var numMovesStones = function(a, b, c) {
    const nums = [a, b, c];

    nums.sort((a, b) => a - b);

    const leftGap = nums[1] - nums[0] - 1;
    const rightGap = nums[2] - nums[1] - 1;

    const maxMoves = leftGap + rightGap;

    if (leftGap == 0 && rightGap == 0) return [0, 0];
    if (leftGap > 1 && rightGap > 1) return [2, maxMoves];
    return [1, maxMoves];
};
Moving Stones Until Consecutive