java O(1)
java\nclass Solution {\n    public int[] numMovesStones(int x, int y, int z) {\n\t\t// sort inputs x, y, z in ascending order\n        int a=Math.min(x, Math.mi
```java\nclass Solution {\n    public int[] numMovesStones(int x, int y, int z) {\n\t\t// sort inputs x, y, z in ascending order\n        int a=Math.min(x, Math.min(y,z));\n        int c=Math.max(x, Math.max(y,z));\n        int b=x+y+z-a-c;\n\t\t// make the container\n        int[] res = new int[2];\n\t\t// calculate the minimum steps on the left and right of the median number\n        res[0] = Math.min(1,b-a-1)+Math.min(1,c-b-1);\n\t\t// special case! \'x_x___x\' becomes \'xxx\' in 1 step\n        if(b-a==2 || c-b==2) res[0] = 1;\n\t\t// get the maximum\n        res[1] = c-a-2;\n        return res;\n    }\n}\n```
[]