Practice Moving Stones Until Consecutive II
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
Stones occupy distinct integer positions. In one move, choose a stone at the smallest or largest occupied position and move it to an empty integer position where it is no longer an endpoint. Continue until all stones occupy consecutive positions. Return [minimumMoves, maximumMoves] over valid ways to finish. Unlike simply moving inside the old endpoints, the moved stone must lie strictly between the new endpoints.
Source: Moving Stones Until Consecutive II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
stones = [7,4,9]
[1,2]
# Example 2
stones = [6,5,4,3,10]
[2,3]
Constraints
Related LeetCode Problems
Practice more problems similar to Moving Stones Until Consecutive II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.