C++/Java 4 lines
Edge case 1: all three stones are next to each other (z - x == 2). Return {0, 0}.\nEdge case 2: two stones are next to each other, or there is only one space in
Edge case 1: all three stones are next to each other (```z - x == 2```). Return ```{0, 0}```.\nEdge case 2: two stones are next to each other, or there is only one space in between. Minimum moves is ```1```.\n\nOtherwise; minimum `2`, maximum - `z - x - 2`.\n\nSo the position of the middle stone (`y`) only matters for the minimum moves.\n\n```\nvector<int> numMovesStones(int a, int b, int c) {\n  vector<int> s = { a, b, c };\n  sort(begin(s), end(s));\n  if (s[2] - s[0] == 2) return { 0, 0 };\n  return { min(s[1] - s[0], s[2] - s[1]) <= 2 ? 1 : 2, s[2] - s[0] - 2 };\n}\n```\nJava version:\n```\npublic int[] numMovesStones(int a, int b, int c) {\n  int[] s = { a, b, c };\n  Arrays.sort(s);\n  if (s[2] - s[0] == 2) return new int[] { 0, 0 };\n  return new int[] { Math.min(s[1] - s[0], s[2] - s[1]) <= 2 ? 1 : 2, s[2] - s[0] - 2 };\n}\n```
[]