This question is related to Find the first un-repeated character in a string in which input is character array and we can take hash of size 256.
But what if,
the elements in the array are integers of wide range, hash can be extremely costly.
the array contains heterogeneous elements, integers or characters, then how can hash tackle this.
we can use brute-force method of scanning entire array for each element but in worst case it takes O(n²).
Any other ideas?