Ad
  • Custom User Avatar

    You are misunderstanding the question.

    The tuple in swaps indicate the position where the swapping takes place. As in

    • The first swap moves the ball from 0 to 1

    • The second swap moves the ball from 1 to 2

    • The final swap doesn't affect the position of the ball. (Because ball is currently at index 2, so the swapping of 0th-indexed and 1st-indexed cup do not affect the ball)

    Note that we are only concerned of the final position of the ball and not the validity of each swapping nor the index / position of invalid swaps.