I know how to find duplicate elements in array but recently in an interview question, I was asked to find duplicate elements in array in a single pass meaning without using nested loops and recursion. I tried but failed. The interviewer wasn't kind enough to even give me a hint. So I came here to ask, Is it possible to find duplicate elements in array without nested loops/recursion? If yes can anybody give an example code? Also Library functions are not allowed
P.S I would also like to know what impact does it have if we don't use loops or recursion. Is it related to complexity?