Microsoft interview question

Create a function that returns the duplicates in an array