2 , Number of special characters ( 25 Points)
In N Integer Array A Only three numbers appear once. 2 Times. Please writeProgramOutput any number that appears only once. The smaller the program time and space complexity, the better.
For example: A = {, 7} , Output 4 Or 5 Or 6
// Ing Number Problem # include <iostream> using namespace STD; int lowbit (int x) {return X &~ (X-1);} void find (int A [], int N) {int I, xors; xors = 0; for (I = 0; I <n; ++ I) {xors ^ = A [I];} // two different or lower lowbits of the three numbers are the same. One difference can be divided into two groups: int FIPS = 0; for (I = 0; I <n; ++ I) {FIPS ^ = lowbit (xors ^ A [I]);} // indicates: flips = lowbit (a ^ B) ^ lowbit (a ^ c) ^ lowbit (B ^ c) int B; // assume that one of the three values only appears once is B = 0; for (I = 0; I <n; ++ I) {If (lowbit (xors ^ A [I]) = FIPs) {B ^ = A [I] ;}} // a number of cout <B <Endl;} void main () {int A [] = {, 6} is successfully found }; find (A, sizeof (a)/sizeof (A [0]);}