I have to compare two or more lists and check if they are the same, but their elements can be in different position. For instance
l1 = {a,b,c}
l2 = {b,c,a}
SameQ[l1, l2]
(* False *)
but I need True.
The shortest way I can think about is
SameQ[Sort[l1], Sort[l2]]
(* True *)
but having to compare many lists and sometimes they are really huge, I don't want to sort. Is there a built-in function or a better way to get that result?
Complement
, but I'm not sure if it would be faster (and check if it's empty). $\endgroup$