ADP interview question

find duplicate in array within n time