I have the following list of Integers
(0,1,2,3)
Now I want to write a method which returns specific number of pairs from the list. So if I give it 5 as argument I will expect it to return the following:
(0,1),(1,2),(2,3),(3,0),(0,1)
So basically when it reaches the end element and another pair is needed, then it should pair the last element of the list with the first one and continue.
Any ideas how can I implement this?