Checking if an array contains duplicate elements

There was some discussion of this in an older thread: Remove duplicate elements from a collection - #23 by Torust.

I'm going to restate what I said there: if you have a small array of simple types, the trivial O(n^2) operation might just end up being the fastest. Otherwise, I'd expect sorting or using a Set to be your best options, as has already been discussed.

1 Like