C++ Program to find unique number in an array of n numbers in which except one (unique number) rest all are present thrice.
Constraints: n<10^5
Example:
Input:
10
1 2 3 2 4 1 2 3 1 3
Output:
4
Solution: Except 4 rest all have multiplicity of 3 in array. For instance 4 are represented as 100 in binary .Starting from left most bit is the first index of count array.
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer