Get all non-unique values (i.e.: duplicate/more than one occurrence) in an array
You could sort the array and then run through it and then see if the next (or previous) index is the same as the current. Assuming your sort algorithm is good, this should be less than O(n2): Expand snippet In case, if you are to return as a function for duplicates. This is for similar … Read more