Given an array having integers with just one integer repeated thrice, how will you find out which integer is that?
Sigiloso
1) You can sort it (O(n*log(n))) and find first repeating number (O(n)). But this is too obvious of a solution. 2) You can use a hash table of size O(n) to store number of occurrences. This is O(n) solution, but requires additional O(n) memory. 3) There must be a trick here, but I can't seem to find it. XOR is useless, and everything else is slower than or equal to O(n*log(n)).