Let's say I have an array of any fixed length i.e. it could be 3, 5, 7 ... upto 30.
How can I generate an algorithm such that if I pick an item from the array, every single day, it should not pick the same item index on any two consecutive days.
Note: I do not have the ability to store, what was picked the previous day.
For example, if my array is ["a", "b", "c", "d", "e", "f"]
valid result would be
["a", "b", "c", "d", "e", "f", "d", "a", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f"]
Invalid result would be
["a", "b", "c", "d", "e", "f", "a", "b", "b", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f"]
Note the consecutive b
in above
An ideal result would be: where the whole array is perfectly rotated after the end of length is reached.
["a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f"]