Sobes.tech
Junior — Senior

Identifying duplicate numbers in an array

livecode

Task condition

Create a function find_duplicates that takes a list of integers and returns a list of all elements that appear more than once. The result should meet the checks below.

assert find_duplicates([1, 2, 3, 4, 5, 4, 2]) == [2, 4]
assert find_duplicates([1, 4]) == []
assert find_duplicates([5, 2, 2, 2, 2, 1]) == [2]