C++ with Explanation
Sort a, b, c in ascending order such that a<b<c. \n\nTo make maximium number of moves:\nFirst, move a towards b by 1 (increase a by 1) in each step until a==b-1
Sort a, b, c in ascending order such that a<b<c. \n\nTo make maximium number of moves:\nFirst, move a towards b by 1 (increase a by 1) in each step until a==b-1. \nSecond, move c towards b by 1 (decrease c by 1) in each step until c==b+1. \nThus, the maximium number of moves is (b-a-1)+(c-b-1)=c-a-2. \n\nTo make minium number of moves:\nScenario 1: a==b-1==c-2. 0 move is required. \nScenario 2: there are two adjacent stones that are 1 away from each other (excluding scenario 1)(Ex. a==b-1). 1 move required (Ex. move c to b+1).\nScenario 3: there are two adjacent stones that are 2 away from each other. 1 move is required (Ex. a==b-2). 1 move required (Ex. move c to b-1).\nScenario 4: all scenarios other than 1, 2, and 3. 2 move required. Move a to b-1, and move c to b+1. \n```\nclass Solution {\npublic:\n    vector<int> numMovesStones(int a, int b, int c) {\n        vector<int> rt;\n        \n        // bubble sort a, b, c \n        if(b<a) swap2( b, a);\n        if(c<b) swap2( c, b);// c is max in {a,b,c}\n        if(b<a) swap2( b, a);// b is max in {a,b}\n        \n        if(a==b-1&&a==c-2)  rt.push_back(0);\n        else if(a==b-2||a==b-1||b==c-2||b==c-1) rt.push_back(1);\n        else    rt.push_back(2);\n        \n        rt.push_back(c-a-2);\n        \n        return rt;\n    }\n    \nprotected: \n    void swap2(int& a, int& b){\n        int t=a;\n        a=b;\n        b=t;\n        return ;\n    }\n};\n```
[]