LeetCode
Moving Stones Until Consecutive
Click
here
for an explanation.