Pregunta de entrevista de BlackBerry

write a function which returns duplicates in an array