Find element which repeated twice in given array where other elements appear thrice
Answers
Answered by
0
Answer:
· Given an array where every element occurs three times, except one ... in what fashion elements appear in array, we still get the answer. ... Once, Twice and Thrice
Answered by
0
Answer:
For an array where every element appears N times, and one of them appears M times.
for every bit position (b): ((sum all the ones at bit position (b))%(N))/M is the bth bit of that number
In this manner construct the entire number
So for this question:
N = 3
M = 1
we can consider numbers to be 32-bit, thus b goes from 0 to 31
Similar questions