Category
The iterable to find duplicates in
A Set
of the duplicated elements
Iterable
duplicates([1, 2, 2, 2, 3]); // Set(1) { 2 }
allDuplicates to receive a array of duplicate elements instead of a Set
(which doesn't include the same element more than once)
Get a
Set
of the duplicate elements in an iterable.Time complexity: O(n)
Space complexity: O(n)