Let's say I've got the following values in a collection of integers:
{1,3,4,5,5,6,7,7}
The result I'd expect is {5,7}
.
How can I do that? Maybe using LINQ?
EDIT: The input collection is unsorted, so the algorithm should not rely on duplicates being consecutive. Also, whether the resulting duplicate collection is sorted or not doesn't matter.