Write a function to find the duplicates in an array in the most efficient way.
Problem statement
Given an array, find all the duplicates that exist in that array.
Input
An integer array.
Write a function to find the duplicates in an array in the most efficient way.
Given an array, find all the duplicates that exist in that array.
An integer array.