Simple solution. O(1) time complexity
Intuition\n Describe your first thoughts on how to solve this problem. \nSort the numbers such that a Always maximum distance is abs(a-b)+abs(b-c)-2.\nMin Dista
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSort the numbers such that a<b<c.\nMax Distance -> Always maximum distance is abs(a-b)+abs(b-c)-2.\nMin Distance -> Min distance should be 0 or 1 or 2. Just check the conditions.\nIf three points are consective then min=0, if any two points abs diff is 2 then min=1,Otherwise min=2.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\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        int ans[]=new int[2];\n        int arr[]=new int[3];\n        arr[0]=a;\n        arr[1]=b;\n        arr[2]=c;\n        Arrays.sort(arr);\n        ans[1]=arr[2]-arr[1]+arr[1]-arr[0]-2;\n        if(arr[2]-arr[1]==1 && arr[1]-arr[0]==1){\n            ans[0]=0;\n            return ans;\n        }\n        else if(arr[2]-arr[1]<=2 || arr[1]-arr[0]<=2){\n            ans[0]=1;\n            return ans;\n        }\n        ans[0]=2;\n        return ans;\n    }\n}\n```
['Math', 'Brainteaser', 'Java']