Back to exercises

Find Duplicates in a List

Walk the list once, keep a set of seen values, and add repeated values into a duplicate set. Convert to a sorted list if stable output helps.

Coding Exercises Easy O(n)

Find Duplicates in a List

Walk the list once, keep a set of seen values, and add repeated values into a duplicate set. Convert to a sorted list if stable output helps.

Return the duplicate values from a list of integers.