There are stones placed at distinct integer coordinates along a number line, represented by the integer array stones.
A move consists of selecting an endpoint stone (the stone located at either the minimum or maximum position) and placing it onto an unoccupied position such that it is no longer an endpoint stone. The game finishes when no valid moves remain, which happens when all stones occupy consecutive positions.
Return an array answer of length answer[0] is the minimum number of moves and answer[1] is the maximum number of moves possible until the game finishes.
Constraints:
stones.length
stones[i]
All the values of stones are unique.
There are stones placed at distinct integer coordinates along a number line, represented by the integer array stones.
A move consists of selecting an endpoint stone (the stone located at either the minimum or maximum position) and placing it onto an unoccupied position such that it is no longer an endpoint stone. The game finishes when no valid moves remain, which happens when all stones occupy consecutive positions.
Return an array answer of length answer[0] is the minimum number of moves and answer[1] is the maximum number of moves possible until the game finishes.
Constraints:
stones.length
stones[i]
All the values of stones are unique.