I read the description several times, but I don't understand why in an example the right answer is [1,8]. In my opinion the right answer is [5,11]. If I have pair of pipe numbers for cannonballs as [0,1] and pairs of working cannons as [4,5] or [11,0], then I need rotate the backend mechanism 5 or 11 times.

Created at: 2016/09/15 13:00; Updated at: 2020/02/26 15:46