Practice Moving Stones Until Consecutive
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Three stones occupy distinct integer positions a, b and c. In a move, choose the leftmost or rightmost stone and place it at any unoccupied integer position strictly between the current endpoints. Play ends when the three stones occupy consecutive positions. Return [minimumMoves, maximumMoves], the smallest and largest possible numbers of moves before the game ends.
Source: Moving Stones Until Consecutive on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
a = 1, b = 2, c = 5
[1,2]
# Example 2
a = 4, b = 3, c = 2
[0,0]
# Example 3
a = 3, b = 5, c = 1
[1,2]
Constraints
Related LeetCode Problems
Practice more problems similar to Moving Stones Until Consecutive.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.