0

Basically I need to order a list, so that an element is not the same as the element that comes after or before it.
For example [1,2,2,3,1,3,3] should come out as [3,1,2,3,1,2,3], [3,2,3,1,2,3,1] or [2,1,3,1,3,2,3] and so on.
I searched for a solution but couldn't find one so I wrote this functi...