coMakeIT interview question

How to print duplicate elements in an array?