Determine if 2 lists have the same elements, regardless of order? [duplicate]
You can simply check whether the multisets with the elements of x and y are equal: This requires the elements to be hashable; runtime will be in O(n), where n is the size of the lists. If the elements are also unique, you can also convert to sets (same asymptotic runtime, may be a little … Read more