Domanda di colloquio di Octro

find Repeating element in an array. Though it differed from the standard problem as here all the elements were random and not first n natural numbers.

Risposta di colloquio

Anonimo

8 nov 2020

The solution to the problem with first n natural nos. can easily be solved by XOR-ing all the elements, but to my problem I couldn't think of any such approach. So I suggested of using a dictionary(python) or a map(c++) and store the count of each variable. He asked me of some more general approach that is without using dict or map. So the only option was to make an array of size of maximum possible element in the given array an store the count.