Best Java Solution || Beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] numMovesStones(int a, int b, int c) {\n\n        int x = Math.min(a,Math.min(b,c));\n        int y = Math.max(a,Math.max(b,c));\n        int z=0;\n\n        // sorting the elements\n        if(x==a){\n            if(y==b) z=c;\n            else z=b;\n        }else if(x==b){\n            if(y==a) z=c;\n            else z=a;\n        }else{\n            if(y==b) z=a;\n            else z=b;\n        }\n\n        a=x;\n        b=z;\n        c=y;\n        int ans[] = new int[2];\n        if(c-a==2){\n            ans[0]=0;\n            ans[1]=0;\n            return ans;\n        }else if(b-a==1 || c-b==1 || b-a==2 || c-b==2){\n            ans[0]=1;\n        }else{\n            ans[0]=2;\n        }\n\n        int k = (b-a-1)+(c-b-1);\n        ans[1]=k;\n        return ans;\n    }\n}\n```
['Java']