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.
This comment is hidden because it contains spoiler information about the solution
You are misunderstanding the question.
The tuple in
swaps
indicate the position where the swapping takes place. As inThe 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.
Can someone help me in this kata description example?
(start = 0 ; swaps = [(0, 1), (2, 1), (0, 1)] ) --> 2
Ball from 0 go to 1 then 2,1 is invalid, and 0,1 is also invalid? Then the answer should be 1? I didnt see any move end in 2?
This comment is hidden because it contains spoiler information about the solution
Yes mine failed with price = 54 discount = 5 holiday_cost = 8856