There's a set of arrays that I want to remove repeated elements that are equal after rotation:
arr = {{1, 2, 3, 4, 5}, {2, 3, 4, 5, 1}, {5, 1, 2, 3, 4}, {4, 3, 2, 5,1}};
The elements {1, 2, 3, 4, 5}
, {2, 3, 4, 5, 1}
and {5, 1, 2, 3, 4}
are the same after operation RotateLeft
. I want to delete the duplicate elements and only get {1, 2, 3, 4, 5}
and {4, 3, 2, 5, 1}
.
DeleteDuplicates[arr, RotateLeft[#1] == #2 &]
However, the above operation can only delete the elements that are equal after one shift.