O(1) solution in JavaScript with comments
javascript\nvar numMovesStones = function(a, b, c) {\n    let arr = [a,b,c].sort((a,b) => a - b);\n    \n    // the num of moves that the last stone can make is
```javascript\nvar numMovesStones = function(a, b, c) {\n    let arr = [a,b,c].sort((a,b) => a - b);\n    \n    // the num of moves that the last stone can make is the maximum\n    const max = arr[2] - arr[0] - 2;\n    \n    // Normally, the num of minimum moves is which is moving `b` next to `a`, then moving `c` next to `b`\n    let min = 2;\n    \n    // if there are no gaps between  `c` and `b`, or `b` and `a`, the num of minimum moves is 1\n    if (arr[2] - arr[1] < 3 || arr[1] - arr[0] < 3) min = 1;\n    \n    // if these three stones are adjacent, there are no moves can be made\n    if (arr[2] - arr[1] === 1 && arr[1] - arr[0] === 1) min = 0;\n    \n    return [min, max];\n};\n```\n\nAlthough a sort function is called at the beginning, the num of params is always 3, so it is O(1) speed.\n\nI hope this solution is clear enough :)\n\n
[]