Easy To Understand 100% Beats
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```cpp []\nclass Solution {\npublic:\n    vector<int> numMovesStones(int a, int b, int c) {\n\n        vector<int>ans(2,0);\n        int x=max(a,max(b,c));\n        int z=min(a,min(b,c));\n        int mid;\n        if(a==x)\n        mid=max(b,c);\n        else if(b==x)\n        mid=max(a,c);\n        else\n        mid=max(a,b);\n\n        if(z+1==mid&&mid+1==x)\n        return ans;\n\n        int m=0,n=0;\n        if((x-mid)<=2 || (mid-z)<=2)\n        {\n            m=1;\n            n=(x-mid)+(mid-z)-2;\n            ans[0]=m;\n            ans[1]=n;\n        }\n        else\n        {\n            m=2;\n            n=(x-mid)+(mid-z)-2;\n            ans[0]=m;\n            ans[1]=n;\n        }\n        return ans;\n\n        \n        \n        \n    }\n};\n```
['Math', 'C++']